I'm trying to create a button which toggles the visibility of the two elements on every other click...this working fine up to a few days ago but now on page load it hides the button. I found that .toggle also works to show/hide elements but how do you use it to toggle between functions on alternate clicks?
JS:
$("#button").toggle(
function(){
$('#stuff1').hide("slow");
$('#stuff2').show("slow");
},
function(){
$('#stuff1').show("slow");
$('#stuff2').hide("slow");
}
);
HTML:
<img id="button" src="button.jpg"/>
<p id="stuff1">stuff</p>
<p id="stuff2">stuff</p>