Category:Retrospective albums
Category:2002 albums
Category:2010 albums
Category:2010s comedy albums
Category:2017 albums
Category:2017 live albums
Category:Live albums by American artistsQ:
select an element by its position in the DOM
I'm trying to select an element by its position in the DOM, but I have a problem that I can't explain (maybe you can?)
I'd like to have the index of the element using jquery (I'm using Jquery because it's better for animation)
var slider = $(".slider");
var i = slider.index();
I'm using the class line in this example, but I could change that easily (some others classes)
My problem is that this works in Chrome and Safari but not in Firefox.
Is there a better way to do that? Or maybe I'm just using the wrong index method?
Thanks a lot for your help
A:
jQuery index() method works only for plain elements, not for all HTML elements.
You could use document.getElementById() method instead to get an element by its ID.
var i = $("div.slider:first").index();
Note, I removed the "slider" class from the code, because you are applying it to all divs.
Q:
How to replace value from JSONArray using RecyclerView adapter
I have a JSONArray be359ba680
Related links:
Comments