I am trying to figure out how to use jquery to take an image with a class of active, to take the “rel” data and apply that text to text inside another div with a h2 tag. I am very new to jQuery and still trying to wrap my mind around it. Please explain what is happenning a bit, so it makes sense! Thank you ahead of time for the answers!
All I can figure out is this:
jQuery (I know I’ll need this… just not sure how to apply it)
var title = $("#slider img.active").attr("rel");
The HTML:
<div id="slider">
<div id="sliderimgholder">
<img class="active" src="images/slider-1.jpg" alt="" rel="image one" />
<img class="" src="images/slider-2.jpg" alt="" rel="image two" />
<img class="" src="images/slider-3.jpg" alt="" rel="image three" />
</div>
<div id="ribbon">
<h2>THIS SHOULD BE POPULATED WITH text image one</h2>
</div>
</div>
Check out the
textfunction:Example: http://jsfiddle.net/eYPW4/