[jQuery] OnDocument click handler not firing for php generated html

[jQuery] OnDocument click handler not firing for php generated html


Ok, I am new to jQuery, and web development in genral, however I was
wondering if somebody could show me the correct way of doing this.
Basically I have a <DIV> in the body which gets it html (including
links) from a post function in "$(document).ready(function(){" (due to
different database user account will be able to see different links).
However when one of these links are clicked, the "$("a").click(function
(){" never fires (it does fire for hard coded links in <DIV> tags that
are not received through the post command).
Code:
HTML:
</head>
<body>
...
<div class="ui-layout-west"><DIV id="links"></DIV></div>
...
</body>
</html>
JavaScript:
<script>
...
    $(document).ready(function(){
     //get links
     $.post("links.php", {InitVar: 1}, function(html) {
     // format and output result
     $("#links").html(html);
     }, "html");
        //Handle Menu Clicks (also $("#menu a") and $("#links a") do not
work)
        $("a").click(function(){
            // stop normal link click
            //e.preventDefault();
            alert("hello World");
        });
    });
</script>
PHP CODE:
<?php
if(isset($_REQUEST["InitVar"])) {
$TheRetHTML = "<BR><BR><table><tr><td><DIV ID='menu'>";
    $TheRetHTML .= "<b>User Links</b><BR>";
    $TheRetHTML .= "<a href='#'>Test1</a>";
    $TheRetHTML .= "</DIV></TD></TR></TABLE>";
echo $TheRetHTML;
}
?>
Thank You for any assistance.