I have a div
that have an onclick event, what I want is activate it or deactivated by clicking on other divs. I don't want to remove it, because I'll use thos onclick later
<div id=goTo onclick="location.href='post.php?id=21';"> go to this page/div>
those are the buttons to click
<div id=deactivate>[click to deactivate]</div>
<div id=reactivate>[click to reactivate]</div>
I want to deactivate/reactivate #goTo
. I've tried .removeAttr()
but I don't want to removed because I don't know how to restore it later
$("#deactivate").click(function(){
$("#goTo").removeAttr("onclick");
});