Jquery not interacting with ajax .load content
Hi I've created a simple example of a problem I'm having:
HTML
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Untitled Document</title>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
- <script type="text/javascript">
- $(function() {
$("a").click(function() {
$("#Array").load('Array.php');
});
- $("#Button").click(function() {
$(this).hide(1000);
});
- });
- </script>
- </head>
- <body>
- <a href="#">Button</a>
- <div id='Button'>3345636</div>
- </body>
- </html>
PHP (Array.php)
- <?php
- echo "<div id='Button'>1234567890</div>";
- ?>
When I click on the "Button" link(<a href="#">Button</a>) the following text appears "1234567890" >>This works perfectly.
When i click on the text "3345636" it hides over one second as defined in the Java Script >>This works perfectly.
The problem is when I click on the new text "1234567890". Even though it has an id="Button" it doesn't hide at all?