3 Replies Latest reply on Oct 28, 2016 12:14 AM by try67

    How do i edit this javascript - to show black text when first initial typing of text field?

    raykohbard Level 1

      Hi All,


      Need some help here!


      I have got a javascript from a forum previously. The purpose of the script is to have a watermark text (grey colour) in the text field box that will hide upon typing. When typing or after data in keyed in, the text should appear full black. The problem with my current script is that when first initial typing of the text, the text is grey colour and only turn full black when exit. How do i keep the watermark in grey, when typing shows black colour text, and black colour text data after input?


      The script is such:

      var message = 'DD'

      if (event.value == '') {

          event.target.display = display.noPrint

          event.value = message



      event.target.textColor = ["G",0.8] ;



      } else {

          event.target.display = display.visible



      if (event.target.value==event.target.defaultValue) event.target.value = "";



      event.target.textColor = ["G",0] ;