Show the whole html, including that div (<div class="tab-content">), which is missing from what you are showing us.
If you replace the content of something, and that content had js events directly tied to the containing elements, you just deleted the events when replacing the contents.
How do i stop the js from breaking on the div upload? delagate?
yes
take the example from the docs: http://api.jquery.com/on/
$( "#dataTable tbody tr" ).on( "click", function() {
console.log( $( this ).text() );
});
So this is assigning a click event to all tr's that currently exist on the page, when the page is initially rendered. The events are directly tied to the tr's on the current page. Delete a tr, the event attached to it goes bye-bye. Add a new tr and it won't get assigned the event since it wasn't present when the page was initially rendered and the events attached to the tr's.
$( "#dataTable tbody" ).on( "click", "tr", function() {
console.log( $( this ).text() );
});
This ties the event to the tbody instead of the tr, but targets the tr. This is more dynamic. If you then add a new tr (or replace all of the tr's), the added tr's will inherit the click event from the tbody. It's also a lot more efficient and uses less memory since it's a single click event for the whole tbody, instead of individual click events on each tr.