jquery on click get element 1

jquery on click get element

$(document).on("click",".appDetails", function () {
   var clickedBtnID = $(this).attr('id'); // or var clickedBtnID = this.id
   alert('you clicked on button #' + clickedBtnID);
});

Here is what the above code is Doing:
1. When the user clicks on the button with the class “appDetails”, the function will be triggered.
2. The function will get the ID of the button that was clicked.
3. The function will alert the user with the ID of the button that was clicked.

Similar Posts