#short
#javascript
#html
#jquery
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:
$(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?
Nesta página do site você pode assistir ao vídeo on-line javascript - jQuery disable/enable submit button duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Code Samples 14 Junho 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 211 vezes e gostou 8 espectadores. Boa visualização!