matheusmurta
10/9/2019 - 8:03 PM

Useful click classes events jquery

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);
});