I have a class called formStyle which occurs several times in my webpage. Is it possible to select let's say first and third (with jquery) if they are five
You can use jQuery's :eq()
-selector, but it is easier (and probably faster, due to native selectors) to select all of them and pick the ones you need afterwards:
var elements = $('.formStyle');
elements.eq(0) // first
elements.eq(2) // third
yep, like this
$('.formStyle:eq(0), .formStyle:eq(2)')
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