I have one function of java-script which is adding content to my HTML page. Also I have light box script added on that page. Now when i am calling light-box function after page load light box script is working fine but when I call that java script function which is appending HTML to my page then on click of the content of added HTML light-box is not working.What should I do
my code is like this
function add_new_block()
{
strnew='<div>\n
<div class="normal_red">
<a href="javascript:void(0);" onclick="return add_new_block();">Add more</a>
</div>
<a href="ajax_show_specific.php?subcat_id=1&catid=2" class="lbOn">Be More Specific</a>
</div>';
document.getElementById("newdiv"+(newcount-1)+subcatid).innerHTML=strnew;
}
Thanks for Help in Advance
I suspect it’s because the new elements are binded to the DOM and so the lightbox script can’t “see” them. Do you have some initialisation script for the lightbox? Something like
initLightbox()? If so add that to the end of youradd_new_block();function.