JQuery for appended code

JQuery for appended code

Hi all!
I start using JQuery a few days ago and everything works fine. But now I've got a question:
I added some code to my page, but this text should also get an click event. If I press the "hier"-Button, the text "hallo" appears. But there is no alert when I click at the "hallo". How can I get this alert?

Thomas

  1.  <?xml version="1.0" ?><!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>
    <title>Test</title>
    <script src="classes/jquery.js" type="text/javascript"></script>

    <script type="text/javascript">
    $(document).ready(function(){

    $(".icon").click(function() { txt='<div id="test">hallo</div>'; $("#body").append(txt); });
    $("#test").click(function() { alert("test"); });

    })
    </script>

    </head>
    <body id="body">

    <div class="icon" id="Text"><b>hier</b></div>
    </body>
    </html>