take an element class and put it to another element as atribute
SOURCE CODE
<div class="level_1 euItem generation_y _2012">
<img border="0" src="img2.jpg" class="euImg" alt="Run">
<a href="/sport/sport_2014/media_gallery/images/car.htm"
class="lightview">Run</a>
</div>
<div class="level_1 euItem youth_forum">
<img border="0" src="img3.jpg" class="euImg" alt="Run">
<a href="/sport/sport_2014/media_gallery/images/aircraft.htm"
class="lightview">Run</a>
</div>
i need to take the third class of a div element and put it as attribute to
a A element
RESULT CODE:
<div class="level_1 euItem generation_y _2012">
<img border="0" src="img2.jpg" class="euImg" alt="Run">
<a href="/sport/sport_2014/media_gallery/images/car.htm"
class="lightview" data-lightview-group="generation_y _2012">Run</a>
</div>
<div class="level_1 euItem youth_forum">
<img border="0" src="img3.jpg" class="euImg">
<a href="/sport/sport_2014/media_gallery/images/aircraft.htm"
class="lightview" alt="Run" data-lightview-group="youth_forum">Run</a>
</div>
i am at this point now, but it doesn't work. note that each div have a
different class that i have to use:
var lightviewGroup = $(this).attr('class').split(' ');
$('div.euBox div.level_1 h4
a.link-ico').attr('data-lightview-group',imgCaption[2]);
No comments:
Post a Comment