Skip to content

Instantly share code, notes, and snippets.

@matheusmurta
Created October 9, 2019 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matheusmurta/b5b3a149bd47855f8ddcbcad65affb33 to your computer and use it in GitHub Desktop.
Save matheusmurta/b5b3a149bd47855f8ddcbcad65affb33 to your computer and use it in GitHub Desktop.
Useful click classes events jquery
$(window).click(function(e) {
console.log(e); // then e.srcElement.className has the class
});
$('div').click(function() {
var theClass = $(this).attr('class');
alert( theClass );
});
$(document).on('click', '.addproduct', function () {
// your function here
});
$('.test').click(function() {
console.log(this.id);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment