[tips] get the eq index order to any element with jquery two different ways
hello i bring to you two ways for get index of element or order of element or jquery naming eq
you can select element by its order(eq) like this
but if you have element and you want to get its eq
1-
jquery introduced index method that gives you the element index
2-
you can get the length of the previous elements so the number is your index :)
so happy coding :) any questions just reply these post :)
you can select element by its order(eq) like this
$('div.name img:eq(2)')
but if you have element and you want to get its eq
1-
jquery introduced index method that gives you the element index
$('.classname').index()
2-
you can get the length of the previous elements so the number is your index :)
$('.classname').prevAll().length
so happy coding :) any questions just reply these post :)
0 Responses to "[tips] get the eq index order to any element with jquery two different ways"
Post a Comment