add data-attribute to buttons to html code example Example: data id tag var dataId = $(this).attr("data-id");