Hmm - and how could you make this code block set the initial length for
pre-populated fields - that was the reason I was trying to use that first
this.  Or was it that?

Maybe I just need to run a second selector that sets all the spans?


Ⓙⓐⓚⓔ wrote:
> 
> this is not this! this is that!
> 
> this is very much dependent on where this is used. inside an .each(),
> this is an element.
> inside a plugin this is a jquery object (& an array of elements).
> 
> the this you used is weird on one, it is probably a null jquery object
> with no elements... but I've never poked in to look!
> 
> as far as debugging... everyone with firefox debugs with firebug...
> some use others... and Internet Explorer users often flip over to
> firefox for better debugging!
> 
>        $('#test :textarea').before('Current length:&nbsp;<span id="'+
> this.id
> +'_len">'+this.value.length+'</span>&nbsp;characters').keypress(
> function()
> {
>                $('#'+this.id + '_len').css('color', ((this.value.length >
> parseInt(this.id.split()[1]))?'red':'green')).html(this.value.length)
>        } );
> 
> might be better as
> $('#test').bind('keypress',function(e){
>      // do your dirty work with this, the textarea
>    $(this).prev('span.count').html(this.value.length)
>     //  ...
> 
> }).before('<span>Current length</span><span
> class="count">0</span><span> chars</>'
> 
> 
> All with no extra IDs!
> 
> On 1/23/07, Daemach <[EMAIL PROTECTED]> wrote:
>>
>> I'm trying to sort out a problem with a selector and I'm not having much
>> luck.  I'm using firebug at the moment, but I'm not able to easily see
>> what
>> the selector is picking up, if anything.  The first selector is here:
>>
>> $('#test :textarea').before('Current length:&nbsp;<span id="'+ this.id
>> +'_len">'+this.value.length+'</span>&nbsp;characters')
>>
>> <form action="boo" name="test" id="test">
>>         <textarea cols="54" rows="5" id="Desc_512"
>> name="Description">SPORK</textarea>
>> </form>
>>
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>>
> 
> 
> -- 
> Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/What-tools-should-I-use-to-troubleshoot-jquery-problems--%28John-Resig%2C-jquery-team%2C-other-gurus-please-share-your-tricks...%29-tf3066235.html#a8549615
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to