I have a dynamically generated table of records and for each row, I have an anchor tag with class name set to ‘hdelete’ to enable me invoke delete method on the particular row’s link that is clicked. I have some code currently that is support to hook up all the anchors with class =’hdelete’
$("#tbl_srecords").click(function (e) {
$(e.target).hasClass("hdelete") ? fnDeletehrecord($(e.target)) : null; //Run the delte row function here
});
The code above does not seem to work. what it currently does is select just the first occurence of anchor with class=’hdelete’. Anyone with a better idea on how to best implement this?
This will bind a function to all anchor tags with class hdelete and call the fnDeletehrecord function with the element as a jquery object past as a parameter.