Have you used the styling by JavaScript on $(document).ready()
function or something? In that case, you need to reinitate the function after the execution of $("#DivId").append(html);
.
Example
You have a function like this:
$(document).ready(function(){
$('a[href="#modal"]').click(function(){
alert("Modal");
});
});
It gets executed in the runtime, after the page loads. You are dynamically inserting another <a>
tag with the same stuff. Eg:
$("#result").html('<a href="#modal">Modal Window</a>');
What happens is, this HTML is inserted after the handler is executed. So, the handler initiated in the $(document).ready()
function is not applicable for this. So, in order to make sure that even this gets executed, you need to reinitialize it this way:
$(document).ready(function(){
loadPage();
});
function loadPage(){
$('a[href="#modal"]').click(function(){
alert("Modal");
});
}
function something(){
$("#result").html('<a href="#modal">Modal Window</a>');
loadPage();
}
Hope you got it?