I've encountered an issue while dynamically creating new classes with input fields in my project. For some reason, when I try to remove a previous row, nothing happens. Can anyone help me troubleshoot this problem?
Here is the JavaScript code that I am using:
$(document).ready(function(){
$("#add_row").click(function(){
var newCommercial = $("<div class='singleCommercial'><div class='form-group'><input class='datetimepicker'></div>");
newCommercial.appendTo($('#listOfCommercials'));
newCommercial.find('.datetimepicker').val(dd+"/"+mm+"/"+yy+" "+time).datetimepicker();
});
$("#delete_row").click(function() {
$(this).closest('.singleCommercial').remove();
});
});
You can view the full page on my fiddle: http://jsfiddle.net/7yd5o63q/12/
Thank you in advance for your assistance!