how to know when a button is clicked in jquery code example Example: detect button click jquery $(".btn").click(function(){ var clk = $(this).attr("id"); });