enable/disable button when user enters text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maheshprof
    New Member
    • Feb 2008
    • 3

    enable/disable button when user enters text

    hi ,
    how to enable a button when i enter a text in a textbox.and also it should be disabled initially after user types a text in the textbox it should enable
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    please post the code you have so far ...

    kind regards

    Comment

    • hsriat
      Recognized Expert Top Contributor
      • Jan 2008
      • 1653

      #3
      Originally posted by maheshprof
      hi ,
      how to enable a button when i enter a text in a textbox.and also it should be disabled initially after user types a text in the textbox it should enable
      Use disabled attribute to disable the submit button initially.
      eg.[html]<input id="button" type="submit" disabled>[/html]
      To enable it, use object.disabled =true | false (example)
      on the onkeyup event of textbox (text input)
      [html]<input type="text" name="abc" onkeyup="docume nt.getElementBy Id('button').di sabled = this.value=='' ? true : false;">[/html]

      Comment

      Working...