Unable to call .click() function on dynamically rendered Element in Datatable jquery

Unable to call .click() function on dynamically rendered Element in Datatable jquery

jepongskijepongski Posts: 1Questions: 1Answers: 0

The datatable is rendering a dynamic "a" tag element

                        url: "../webservices/visitorpass.asmx/ActivePass?locationID=" + $("#propertyID").val()
                        , method: "get"
                        , dataType: "json"
                        , success: function (data2) {
                            $("#tblebrowse").dataTable({
                          ......
                      .......
          render: function (data,type,full,meta) {
                                         return '<a href="#ModalManualCheckOut" id="manCheck#' + full.VisitorID + '#' + full.PassNo + '" data-toggle="modal" data-target="#ModalManualCheckOut"><span id="lblPassNo#' + full.PassNo + '">' + full.PassNo + '</span></a>
.....
.....

and i created a script to call a function whenever that "a" element was clicked
$("[id^=manCheck]").click(function (e) { var str=this.id; var ret = str.split("#"); alert("hello"); $("#manCardID").text(this.text); $("#visitorID").val(ret[1]); });
click function is not being called, what could be the reason?

Answers

This discussion has been closed.