Checkbox are not submitting after dynamically adding new rows in Datatable

Checkbox are not submitting after dynamically adding new rows in Datatable

RushdiRushdi Posts: 13Questions: 3Answers: 0
edited April 2020 in Free community support

I am using the following code to add a new row in the Datatable. row will be added successfully; however newly added checkbox is not working unless page has been refreshed.

     // this method supposed to give alert; however it won't work unless html page has been refreshed  
     $dataTable.$('input[name=chkbox]').click(function () {

        alert(Testing);
     }); 


                $dataTable.row.add([
                    '<input type="checkbox" name="chkbox" value= '+Forum_Id+' />',
                    '<div class="forumLogo" style="background-image: url(' + response.message.imageUrl + ')"></div>'
                    + '<div class="forumData">'
                    + '<div class="forumTitle">' + ' <a id="forumTitle" href=' + ForumRoute + '>' + response.message.title + '</a>' + '</div>'
                    + HasRecentPost
                    + '</div>',
                    '<div class="forumPostCount">' + response.message.numberOfPosts + ' Posts</div>' +
                    '<div class="forumUserCount">' + response.message.numberOfUsers + ' Users</div>',
                    '<div class="forumDescription">'+ response.message.description +'</div>', EditOrDeleteBtn



                ]).node().id = RowId;

Answers

This discussion has been closed.