Saturday, 15 January 2011

loops - how to iterate jquery wildcard selector withouth using each -



loops - how to iterate jquery wildcard selector withouth using each -

i have iterate through ids starting "initial_" different iterator.

what tried @ moment is:

counter = 5 $("[id^=initial_]").each(function () { while (counter > 0) { counter--; stuff here current id , manipulate counter } go next id }

any idas on how it? give thanks help

i think improve utilize instead of each , while seek this:

var arr = $("[id^=initial_]"); var i=0; for(i=0;i<arr.length;i++){ $('#'+arr[i].id).html("i'm number "+ (i+1)) }

jquery loops iterator each

No comments:

Post a Comment