geting data-id from a clicked link using on()

geting data-id from a clicked link using on()

Hi,

If I have:
  1. $(document).on("click", ".topReply", function (evt) {
  2.                 evt.preventDefault();
  3.                 console.log("On dynamic reply click: " + $(this).data("id"));
  4.                 $("#btnJqueryReply").data("mode", "Follow");
  5.                 $("#btnJqueryReply").data("id", $(this).data("id"));
  6.                 $("#dialog-form").dialog("open");               
  7.             });
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.