Thanks for the link.
Here's what I came up with:
$(document).ready(function(){
$('textarea').prepend('Current length: <span id="'+ this.id
+'_len">'+this.value.length+'</span> characters').keypress( function()
{
$('#'+this.id + '_len').css('color', ((this.value.length >
parseInt(this.id.split()[1]))?'red':'green')).html(this.value.length)
} )
});
<textarea cols="54" rows="5" id="Desc_512"
name="Description">SPORK</textarea>
I'm not sure you can generate a selector dynamically, as I did in the
keypress function. It seems to be choking on the this.value element as
well.
It would be really neat if this worked :) Any advice would be appreciated.
I just want to understand how jquery thinks.
--
View this message in context:
http://www.nabble.com/Textarea-character-count-tf3062230.html#a8524860
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/