using this to get name of the clicked element

JavaScript
var clickedBtnID = $(this).attr('id');
Source

Also in JavaScript: