events jQuery

Estimated reading time: 1 minute

click

$(function() {
    $("#demo").click(function() {
        $("body").html(Date());
        alert("ok");
    });
});

onclick

<p onclick="myFunction(this, 'red')">Click me to change my text color.</p>

<script>
function myFunction(elmnt,clr) {
  elmnt.style.color = clr;
}
</script>
$('body').on('click', '.editProduct', function () {
      var product_id = $(this).data('id');
//
}
<a data-id="123">link</a>
$(this).data("id")
js, jquery