0

I am adding HTML to the DOM with jQuery to an existing empty table with class sec_sch like this:

details += "<tr>"+
    "<td class=\"use\">" + this.name + "</td>" +
    "<td>" + this.start_year + "</td>" +
    "<td>" + this.end_year + "</td>" +
    "<td>" + this.qualification + "</td>" +
    "<td>" + "<button class=\"rmv\">-</button>" + "</td>" +
"</tr>";
$(".sec_sch tbody").append(details);

It loads fine but I cannot seem to manipulate the button.rmv from the same JS file with such code.

$('.rmv').click(function(e) {
    console.log(this);
    e.preventDefault();
    alert('hi');
}); // end of remove secondary school

please any idea why?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Ashahmali
  • 113
  • 7

0 Answers0