geting data-id from a clicked link using on()
Hi,
If I have:
- $(document).on("click", ".topReply", function (evt) {
- evt.preventDefault();
- console.log("On dynamic reply click: " + $(this).data("id"));
- $("#btnJqueryReply").data("mode", "Follow");
- $("#btnJqueryReply").data("id", $(this).data("id"));
- $("#dialog-form").dialog("open");
- });
and I have data-id on the link being clicked, is $(this) the correct scope to get at the id?
$(this).data("id")
It is coming back as undefined, its the first time I have had to do this inside on() so am wondering if I am getting something wrong with the scope of $(this) and if so how would I get at the links data-id?
Thanks in advance.