javascript - How to add class to img element in array? -
simply trying add class img in array
aftarray = $('.aft'); // creates array of html imgs aftarray[0].addclass('currenttest'); // should change css adding class here resulting error ff
[12:53:18.593] typeerror: aftarray[0].addclass not function... wtf? thanks!
you trying call addclass on dom object instead of jquery object. indexer gives ojbect need use eq() jquery object.
aftarray.eq(0).addclass('currenttest'); you not have iterate in particular case.
$('.aft').addclass('currenttest');
Comments
Post a Comment