Forum Moderators: open
$.fn.toggleClick = function(e) {
this.toggle();
if (e.stopPropagation) e.stopPropagation();
e.cancelBubble = true;
return this;
} <div onClick="
$('#example').toggleClick(e)
.ajax('https://www.example.com/whatever.php')"> function(e) {...}
$.fn.toggleClick = function(x) {
this.toggle();
if (x.stopPropagation) x.stopPropagation();
x.cancelBubble = true;
return this;
}
use toggleClick(e) use toggleClick(event) use toggleClick(e)
$( "#example" ).click(function(e) {
e.preventDefault();
this.toggle();
return this;
}