JQuery Add Class To Object With .get() Method
running into a weird thing and I'm not sure what's going on. I've grabbed the index of a DOM element via .index(), found a matching element via .get() and I'm trying to add a class
Solution 1:
You need to wrap it into a jquery object.
$(nFLi.get(active)).addClass('active');
Or you could use .eq method instead of .get
, which returns a jquery object instead of original HTMLElement.
nFLi.eq(active).addClass('active');
Post a Comment for "JQuery Add Class To Object With .get() Method"