[jQuery] image toggle
[jQuery] image toggle
Hi,
I am trying to create a toggler that I would like to work
as follows:
User clicks on #my_header and source of the image gets replaced.
I tried the following but it did not work.
<div title="show/hide" id="my_header" >
<img src="images/arrow_down.gif"/>
<span>Some title here</span>
</div>
$(function() {
$('#my_header').click(
function() {
$('#my_header img').src = $('#my_header img').src.replace( /_down
\.gif$/, '_up.gif' );
},
function() {
$('#my_header img').src = $('#my_header img').src.replace( /_up
\.gif$/, '_down.gif' );
}
);
});