finding all empty text fields with jQuery

Needed to do a basic validation check for a client which simply told the user that not all the fields have been completed are they sure they want to continue. Turns out jQuery made this simples with the command $(":text[value=]") which returns all the objects. In the end my (cut down) function that I used on submit of the form was:

function emptyFieldCount(){ var fieldCnt = $(":text[value=]"); var isOk = true; if(fieldCnt.length > 10){ isOk = confirm('Are you sure you want to continue, not all fields have been filled out'); } return isOk;}
comments powered by Disqus