I am having an input text field and a button. When the text field is empty the button should disable. when the field is filled the button should be enable. I tried with the following code but not working properly help me!
$(document).ready(function(){
$("#wmclrsrch").attr("disabled", "disabled");
if ( $('#search_number').is(":empty") ) {
alert ("verdadeiro");
$("#wmclrsrch").attr("disabled", true);
}
$('#wmsearch').click(function(){
$("#wmclrsrch").attr("disabled", false);
$("#wmclrsrch").attr("enabled", true);
});
});
The HTML is:
<form id="form">
<label for="search_number">Mobile Number:</label>
<input id="search_number" type="text" />
<button id="wmclrsrch">Clear Search</button>
</form>
Thanks in Advance,