vendredi 20 février 2015

Check if input field has text, with the value="" attribute set


I have an input field like this (and it must have value=""):



<input type="text" id="title" value="" name="title">


How can I check whether or not the input has any text? I've tried this, but because of the value="", it seems to not correctly evaluate that the input has actual text:



if ($('input').val().length)
{
// do something
}


Thanks.





Aucun commentaire:

Enregistrer un commentaire