I placed many textboxes on my page and all have the same class .myClass.
I want to check if all are filled out or not. How I can find out via jQuery?
I placed many textboxes on my page and all have the same class .myClass.
I want to check if all are filled out or not. How I can find out via jQuery?
if ($('input:text.myClass[value=""]').length > 0)
{
// you have some text boxes which are empty
}
Please see this, hope it helps. Also the code bellow will apply a $.trim() so that inputs filled with a space will validate as empty.
$("input.myClass").each(function(){
if($.trim($(this).val()) == ""){
// if you reach this then at least one textfield is not filled.
// so this is where you decide what to do ( for example, assign FALSE to a 'all_textfileds_filled' variable )
}
});
Cheers