How can i get the count of my error class on the view ?
I am adding .error class with some span and input controls.But its not necessary the all controls will show at the time of form loading or submitting.
So i just want to get count of the .error class which are showing currently on the form,with the help of jquery.
Can any one help me out on this ?
To get the number of elements that have .error class and are showing currently on the form you can do:
var count = $("form .error:visible").length;
var count = $('.error').length;
is this what you're after?
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