Thanks - that did it. I knew I was making this a lot more difficult
than it needed to be.
I'd actually tried something syntactically similar to what you
suggested before, but it didn't work:
$(".CustomClass").each(function(i){
$(this).addClass(i);
});
As you pointed out, however, this w
"but it definitely is not doing what I expect"
Start by understanding that the selector value is typically a *string*
value
Also, the "each" function passes an index along to the event, so with
those both said:
$(".CustomClass").each(function(idx){
$(this).addClass("index_" + idx);
});
2 matches
Mail list logo