Jambhalheart Posted December 6, 2012 Report Posted December 6, 2012 How to set index value for jquery each function ()... for ex : [size="2"]([/size][size="2"][color="#a31515"][size="2"][color="#a31515"]"#ctl00_cphmain_gview"[/color][/size][/color][/size][size="2"]).find([/size][size="2"][color="#a31515"][size="2"][color="#a31515"]'tr:gt(1)'[/color][/size][/color][/size][size="2"]).find([/size][size="2"][color="#a31515"][size="2"][color="#a31515"]'td:gt(3)'[/color][/size][/color][/size][size="2"]).each([/size][size="2"][color="#0000ff"][size="2"][color="#0000ff"]function[/color][/size][/color][/size][size="2"]([b]index[/b], val) { });[/size] [size="2"]here normally each function will start that index from 0, but I want that [b]index[/b] to be started from 4 and then increment with 4 like 4,8,12,16 etc.,[/size] [size="2"]how to do this.. please help... [/size]
Avinash Posted December 6, 2012 Report Posted December 6, 2012 index ki 4 add chey function lo saripothundi ga
chinni005 Posted December 6, 2012 Report Posted December 6, 2012 [size=6][quote name='Maddy_Rulez' timestamp='1354772496' post='1302903803'] How to set index value for jquery each function ()... for ex : ([color=#A31515][color=#A31515]"#ctl00_cphmain_gview"[/color][/color]).find([color=#A31515][color=#A31515]'tr:gt(1)'[/color][/color]).find([color=#A31515][color=#A31515]'td:gt(3)'[/color][/color]).each([color=#0000FF][color=#0000FF]function[/color][/color]([b]index[/b], val) { }); here normally each function will start that index from 0, but I want that [b]index[/b] to be started from 4 and then increment with 4 like 4,8,12,16 etc., how to do this.. please help... [/quote][/size]
TOM_BHAYYA Posted December 6, 2012 Report Posted December 6, 2012 [quote name='Avinash' timestamp='1354772863' post='1302903820'] index ki 4 add chey function lo saripothundi ga [/quote] Index +4 ani pedithe. index value aithe 4 aithadhi kaani. akkada "val" Object still be the first object aithadhi kadha vayya
Jambhalheart Posted December 6, 2012 Author Report Posted December 6, 2012 [quote name='Avinash' timestamp='1354772863' post='1302903820'] index ki 4 add chey function lo saripothundi ga [/quote] index 4 ani pedithe.. first value j=0 and j+4 will be 4, in next, j will be 1 and again j+4 will be 5 not 8 ! in third, j will be 3 and 3+4 =7 not 12... so this will not get the result i wanted...
Jambhalheart Posted December 6, 2012 Author Report Posted December 6, 2012 [quote name='TOM_BHAYYA' timestamp='1354774854' post='1302903916'] Index +4 ani pedithe. index value aithe 4 aithadhi kaani. akkada "val" Object still be the first object aithadhi kadha vayya [/quote] yes correct....
Avinash Posted December 6, 2012 Report Posted December 6, 2012 neeku multiples of 4 kaavali ante... condition apply chey index+1 * 4
worstandhra Posted December 6, 2012 Report Posted December 6, 2012 Very simple.. But this is the problem with jQuery. you cant really have control on index. If you want to do it for multiples of 4, set a var i = 4 outside each function. And then inside each function... add the very first line as if(i%4 == 0) { ......This should be the whole body of each function ...... } i++; I know this is not the optimized behaviour but it works. I will let you know once if I get better idea.
Recommended Posts