tags:

views:

49

answers:

3

How can I do this in textarea

$(this).text() = $(this).text().substring(0, 20);
+1  A: 
$(this).text($(this).text().substring(0, 20));
RaYell
.val for textarea's
redsquare
text() will work as well
RaYell
I would not advise it if it does. why type more?
redsquare
+4  A: 
David Dorward
A: 

Always try to cache the selector in a var if you find yourself doing $(this) or $('#something') multiple times.

var $this = $(this);

$this.val( $this.val().substring(0, 20) );
redsquare