The textarea's id and name are all lower case (textareaname) and the
selector has an uppercase character (textareaName). CSS selectors are
case sensitive.

There's also brackets missing in the second group of $() calls.

The "val()" function is the way to get and set the content of a
textarea. The "text()" and "html()" functions will return different
results for different browsers.

Karl Rudd

On Wed, May 7, 2008 at 12:10 PM, JP <[EMAIL PROTECTED]> wrote:
>
>  nothing seems to work.
>  how does jquery  prefill a textarea ?
>
>
>  <!DOCTYPE html>
>  <html>
>  <head>
>  <title></title>
>  <script type="text/javascript" src="http://code.jquery.com/jquery-
>  latest.pack.js"></script>
>  <script type="text/javascript">
>
>  $(function() {
>   $("#textareaName").val("hello1");
>   $("#textareaName").text("hello2");
>   $("#textareaName").html("hello3");
>
>   $("[EMAIL PROTECTED]'textareaName']".val("hello4");
>   $("[EMAIL PROTECTED]'textareaName']".text("hello5");
>   $("[EMAIL PROTECTED]'textareaName']".html("hello6");
>
>   $('textarea').val( "hello7" ) ;
>   $('textareaname').val( "hello8" ) ;
>
>  });
>  </script>
>  </head>
>  <body>
>  <div>
>    <textarea
>            id="textareaname"
>            name="textareaname"
>            rows="5"
>            cols="20"></textarea>
>  </div>
>  </body>
>  </html>
>

Reply via email to