I need help getting an image to toggle ‘on’ and ‘off’ states when clicked as well as toggle a div to show/hide. I need these to toggle back and forth when clicked. Any ideas?
<a href="#" onclick="toggle();"><img src="/images/control.png" /></a>
<div id="box1">
Showing first box content
</div>
<div id="box2" style="display:none;">
Show second box content when control image is clicked
</div>
I would use unobtrusive script for this if possible, like this:
Then you can bind it to toggle then, like this: