I'm a novice at jQuery, so go easy on me!
I'd like to assign a click() function to an element inside a div. The trouble is that the element has been loaded from an external html source.
In other words, I'm loading a "close" button inside a div that should hide the div itself.
The result I'm getting is that the close button does nothing when clicked. What am I doing wrong?
Thanks!
index.html:
<html>
<head>...</head>
<body>
<div id="container"></div>
</body>
</html>
load.js:
$(document).ready(function() {
$('#container').load('content.html');
});
content.html
<html>
<head>...</head>
<body>
<div id="close"></div>
</body>
</html>
close.js
$(document).ready(function(){
$("#close").click(function(){
$("#container").hide(0);
});
});