The
Example:
Matthew
onclick
is firing even though you are removing it from the code. Once you click it, it fires, then you remove the onclick
function. What I would suggest is to cache and remove all of your onclick
's upon $(document).ready
. Once those are cached and removed, then you can use the code Marc provided above.Example:
jQuery(document).ready(function($) {
var $links = $("td.ms-vb a")
$links.each(function() {
var $this = $(this)
;
// Cache onclick handler.
// Remove the default onclick.
$this.data('onclick', this.onclick);
// $this.data("onmousedown", this.onmousedown);
// $this.data("onfocus", this.onfocus);
this.onclick = $.noop;
// this.onmousedown = $.noop;
// this.onfocus = $.noop;
});
$links.on("click", function(event) {
event.preventDefault();
// Do what you want here
});
});
Cheers,Matthew