I want to change the src attribute of img inside of my span with id="slider_arrow",
<span id="slider_arrow">
<img />
</span>
each time my jquery function runs:
$("#0").click(function () {
/*Rest of the function*/
var arrow = document.getElementById('slider_arrow');
/*I want to add different slider_arrow's sprite each time i call this function*/
});
CSS:
.red_arrow_sprite{
width:25px;
height:12px;
background:url("/Images/arrows.png") 0 0px;
}
.yellow_arrow_sprite{
width:25px;
height:12px;
background:url("/Images/arrows.png") -26px 0px;
}
.black_arrow_sprite{
width:25px;
height:12px;
background:url("/Images/arrows.png") -51px 0px;
}
My CSS Sprite file has 75px width and 12px of height. Each picture has 25px/12px.
The questions are:
1) Do I have correctly written CSS rules?
2) What I need to use to change src of img inside of span?
Thanks!
Fiddle: http://jsfiddle.net/vtkppwuc/3/