Another fantastic tip.  Thank you.


Klaus Hartl wrote:
> 
> Daemach 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>
>> 
>> BTW the documentation doesn't show a :textarea selector in the form
>> section
>> - should that be added or is that where I'm going wrong?  I've tried
>> using
>> $("#Desc_512") as well and I'm still getting a "this.value has no
>> properties" error.  I'm not sure it's grabbing the right element :/
>> 
>> It would be insanely useful to write a doc talking about tools and code
>> snippets you could use to troubleshoot jquery stuff.  Debugging hooks,
>> like
>> being able to pause and dump data (array contents, current dom element,
>> etc)
>> between chained functions would be great too. I'm a visual guy so being
>> able
>> to use something like dump() 
> 
> If you already use FireBug, nothing easier than that...:
> 
> console.log( $('#test :textarea') );
> 
> I often do that first if something is wrong and I'm not sure if my 
> selector is correct. The complete object (in this case the jQuery 
> object) is logged to the console and you can than click on it to further 
> inspect the object.
> 
> This also works pretty well with DOM objects:
> 
> console.log( $('#test')[0] );
> 
> A click on that logged element takes you directly to the DOM inspector 
> to where the particular element is located in the tree. Saves you 
> searching from body down and let's you easily check if newly elements 
> are added in the correct plaze.
> 
> -- Klaus
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> 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#a8552729
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to