if(!$.trim($('.xlarge').value).length) {
return false;
}
And the HTML is:
<input class="xlarge" name="name">
I checked on my console if the syntax is right, it is right, but even if the value is not empty it still doesn't submit the form. What's wrong?
No need to check length just use :
if(!$.trim($('.xlarge').val())) {
return false;
}
val() returns the value of the input - docs for val()
Discussed here Check if inputs are empty using jQuery
if($.trim($('.xlarge').val()) == "") {
return false;
}
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