How do I start jQuery $.each()
index from 1 instead of 0?
I am using .each function to populate select box. So here I want to populate options in the se
Not possible. jQuery.each
loops over Objects (Arrays). For real objects, it uses a for in
loop. Objectpropertys don't have a guaranteed index at all by the way.
For Arrays it uses standard for loop
, but you don't have access to the starting index.
Your best shot is to just skip the first element.
$.each(obj, function(index, elem) {
if( index === 0 )
return true;
// code
});