got a problem using width()

got a problem using width()

I want the text area to auto-expand to fit the div's width. But so far it doesn't work.

  1. <!DOCTYPE HTML>
    <html>
    <head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script>
    $(function(){
        function setWidth(target_object){
            var width = target_object.width();
            this.css("width", width);
        }
        $("#note").setWidth($(".content"));
    });
    </script>
    </head>

    <body>

    <div class="content" style="background:#CCC">
        <textarea id="note"></textarea>
    </div>

    </body>
    </html>