[jQuery] Re: jQuery improving performance

2007-12-03 Thread Amit Uchat
thank you all for quick and quality replys... I am re-writing my script to accomodate new suggestions. and profile my function again to check any improvement. Thanks, Amit On Dec 3, 2007 10:36 AM, Dave Methvin <[EMAIL PROTECTED]> wrote: > > > > I want to improve performance for following snipet

[jQuery] Re: jQuery improving performance

2007-12-03 Thread Dave Methvin
> I want to improve performance for following snipet when run for 1000 times. > > jQuery(".Grid_Item,.Grid_AltItem").each( function() { //begin for-each TR > id = jQuery(this).find(".IdCell").text(); > foo = jQuery(this).find("#foo").val(); > bar = jQuery(this).find("#bar"

[jQuery] Re: jQuery improving performance

2007-12-03 Thread Flesler
I'm not sure which one is faster but instead of $ ("tr.Grid_Item,tr.Grid_AltItem"), maybe $ ("tr").filter('.Grid_Item,.Grid_AltItem') is faster. Also instead of calling 3 times $(this), you can do: var $this = $ (this); $this... Ariel Flesler On Dec 3, 5:57 am, Suni <[EMAIL PROTECTED]> wrote

[jQuery] Re: jQuery improving performance

2007-12-03 Thread Suni
This might help a bit (not tested): jQuery("tr.Grid_Item,tr.Grid_AltItem").each( function() { // Use tr to skip checking nont-tr-elements var td_nodes = jQuery(this).find('td'); // Get the td nodes with a single select and store them in a variable var Id = td_nodes.eq(2).text();