i have a datalist in my page. it has Hyperlink
<a href='#' class="lnkviewcontentclick" id="contentlink" runat="server" recid='<%#DataBinder.Eval(Container.DataItem,"link")%>' >Click</a>
and my script is
<script type="text/javascript">
$(document).ready(function () {
$(".lnkviewcontentclick").click(
function (event) {
event.preventDefault();
if (confirm("Are you sure you wish to delete this user?")) {
var lnk = $(event.target).attr('recid');
alert(lnk);
}
});
});
</script>
but the it return undefined
the above code got worked in php
pls help
In a click callback, you can use
thisinstead of event.target to get the element. Event.target is used when events bubble up.