Q:

How to create a textarea with jQuery and/or javascript?

I need to create a textarea with jquery and/or javascript.
I am using this code ( click here for preview ) but backspace, enter, simbols and lowercase doesn't work. Why ?:
<!DOCTYPE html>
<html>
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
        <meta charset=utf-8 />
        <title>TEST</title>
        <!--[if IE]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <script type="text/javascript">
        <!--
            $(document).keyup(function (event) {
                var keyCode = event.keyCode;
                $('#mytext').text(function (i, text) {
                    return text + String.fromCharCode(keyCode);
                });
            });
        // -->
        </script>
        <style>
            #cmd {
                position: relative; 
                font-family: courier;
                font-weight:bold;
                font-size: 14px;
                padding: 5px;
                overflow: hidden;
            }
            #mytext {
                float: left; 
                padding-left: 3px;
                white-space: pre;
            }
        </style>
    </head>
    <body>
        <div id="cmd">
            <br>
            <div id="mytext">hello </div>
        </div>
    </body>
</html>

A:

Why not have those keys call a function to place html in between <div id="cmd"></div>
I could not find a keypress event function but it this should give you an idea
if (keycode==31) {
    $("#cmd").append("<br/>");
}

31 is code for enter.
Look here, they discuss jquery functions on keypress:
jQuery Event Keypress: Which key was pressed?

