Is it possible to get the index on the first instance of a hasClass?
For Example:
$(".class").children().hasClass('classname').index();
Unfortunately this doesn't work.
.hasClass returns a boolean, you can filter the results of .children to those that have the classname-class and then get the index:
$(".class").children(".classname").index();
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