Last active
August 29, 2015 14:21
-
-
Save jtribble/0c115886cc5cd76b101e to your computer and use it in GitHub Desktop.
For those frustrating times when you need to override an onclick event.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
var offendingElement = $('.dumb-thing'); | |
offendingElement.each(function() { | |
$(this).data('onclick', this.onclick); | |
this.onclick = function(event) { | |
if (somethingIsWrong()) { | |
return false; // don't call the onclick | |
} | |
$(this).data('onclick').call(this, event || window.event); | |
}; | |
}); | |
function somethingIsWrong() { | |
return (!its.ok); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hola querida
¿Cómo están usted y actividades, soy la señora Christina, vi tu perfil hoy luego me interesé saber algo más, así que por favor amablemente Wright para mí a través de mi dirección de correo electrónico ([email protected]) y también tengo algo muy importante que el discurso con usted, gracias, estoy esperando a leer de usted pronto.
Su nuevo amigo ([email protected])