i have this hmtl:
<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
$(document).ready(function(){
$('input[type="submit"]').attr('disabled','disabled');
$('input[type="text"]').change(function(){
if($(this).val != ''){
$('input[type="submit"]').removeAttr('disabled');
}
});
});
..but it doesn't work.any ideas? thanks