Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

jquery disable enable submit button

jquery disable enable submit button  using -'javascript,jquery,html,forms'

I have this html:

<input type="text" name="textField" />
 <input type="submit" value="send" />

How can I do something like this:

When the text field is empty the submit should be disabled (disabled="disabled").
When something is typed in the text field to remove the disabled attribute.
If the text field becomes empty again(the text is deleted) the submit button should be disabled again.

I tried something like this:

            if($(this).val != ''){

..but it doesn't work. Any ideas? Thanks.

asked Sep 9, 2015 by rajesh
0 votes

Related Hot Questions

Government Jobs Opening