how to get the element by html data id in javascript code example Example: data id tag var dataId = $(this).attr("data-id");