Using js inside loaded (by load()) content. Script not doesnt apply to elements loaded by load().
Hi everyone,
I'm new to AJAX.
I got a page with menu on the left and content on the right. Links in menu load content which consists of:
<a class="x" name="y">link</a>.
My script looks like that:
<head>
<script type='text/javascript'>
$(document).ready(function(){
$("a.x").click(function(event){
event.preventDefault();
$("div[name='content']").load($(this).attr('name'));
});
});
</script>
</head>
<body>
<table>
<tr>
<td>
<a class="x" name="y1.html">link</a>
<a class="x" name="y2.html">link</a>
</td>
<td>
<div name="content">
</div>
</td>
</tr>
</table>
</body>
Menu i working fine, but if loaded content also contains a link like "<a class="x" name="y3.html">link</a>" this link does not work - script is not fireing when it is clicked.
I suppose there is a simple solution, but like i said im new to AJAX.
Hope i explained it well enough.
Thanks in advance,
enthree.