I am facing an issue with loading two HTML pages into a single div. I have index.html and try.html in the root folder, where try.html is loaded into index.html's div (#content) when Button 01 is clicked on index.html. The problem arises when I further click on a button within try.html (which is now loaded in index.html's div), as it does not execute properly and triggers the event before it occurs. How can I access the button of try.html on the proper event?
Upon trying to resolve the issue, I found that the code executes before the actual event takes place. Here is the relevant code:
http://pastebin.com/RGcXGFXY
Relevant code:
$('document').ready(function(){
$('#myBtn').click(function(){
$('#content').load('try.html');
$('#myBtn2').click(alert('It Works'));
});
});