Reputation: 137
I'm trying to validate multiple fields at once, but e.g. $('select[name="country"], input[name="prefix"]').parsley().validate();
is not working.
To be precise, the select
seems to be the issue as I can validate $('input[name="prefix"]').parsley().validate();
but $('select[name="country"]').parsley().validate();
is not working :(
What could be the reason? Thanks for your input, I'm still learning...
Upvotes: 0
Views: 898
Reputation: 6467
Apparently parsley
does not work on a set of elements, in that case validation is only applied to first element from the set.
An alternative to work-around your problem would be to loop the set of elements as follows:
$('input:first, input:last, select').each(function(index, el){
$(el).parsley().validate();
});
Upvotes: 1