[SCRIPT]-JQUERY COUNTING ELEMENTS
JQUERY COUNTING ELEMENTS
Something like:
$("select").each( function (i) {
$(this).addClass( "select_" + i ); //Classes can't start with a number.
});
$('select').each(function(index) {
$(this).addClass('prefix_' + (index + 1));
});
Note that a class name cannot start with a number so make sure the class name starts with a letter and then put the index.
$("select").each(function(i, sel) {
$(sel).addClass("class-" + i);
}
Edit: forgot classes can’t start with a number.