The below code works. If there is some better way please let me know. If i use the script content which is present in test.html in the main page where I am loading test.html
One option is to initialize your script on load success:
$('.test').on('click',function(){ $('#ajaxload').load('test.html',function(){ $('body').on('click', '.heading', function(){ $(this).css('color','red'); }); }); });