I'm making a form with inputs, if the input type is empty then the button submit is disabled but, if the input fields is with length > 0 the submit button is enabled
<input type='text' id='spa' onkeyup='check()'><br>
<input type='text' id='eng' onkeyup='check()'><br>
<input type='button' id='submit' disabled>
function check() {
  if($("#spa").lenght>0 && $("#eng").lenght>0) {
    $("#submit").prop('disabled', false);
  } else {
    $("#submit").prop('disabled', true);
  }
}
it works but if then I delete for example the content of input spa the button submit is still enabled
Use trim and val.
var value=$.trim($("#spa").val());
if(value.length>0)
{
 //do some stuffs. 
}
val() : return the value of the input. 
trim(): will trim the white spaces. 
use .val(), it will return the value of the <input>
$("#spa").val().length > 0
And  you had a typo, length not lenght.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With