Michael
Michael

Reputation: 13636

Clear text box using jquery

I have this HTML element:

<div id="setProfessionalDitailsArea">
<input type="textbox" id="instituteName" placeholder="Instetute Name">
</div>

at some point I try to clear text box:

  $("#setProfessionalDitailsArea input[textbox]" ).val('');

But it dosen't work,while this:

  $("#sinstituteName" ).val('');

Works perfect!

Any idea why is the first option not working?

Upvotes: 0

Views: 39

Answers (1)

Mohamed-Yousef
Mohamed-Yousef

Reputation: 24001

use this

$("#setProfessionalDitailsArea input[type='textbox']" ).val('');

for more information about selectors .. this is very useful http://code.tutsplus.com/tutorials/the-30-css-selectors-you-must-memorize--net-16048

Upvotes: 2

Related Questions