I’ve got a fiddle going here to show what I’m trying to do.
I have a table that is generated dynamically, so the columns could appear in whatever order the user chooses. So, I’m trying to get the index of two specific headers so that I can add a CSS class to those two columns for use later.
You should use
.filter()here instead (and whenever you need to restrict the element set), since your.each()returnis getting thrown away, like this:You can test the updated/working fiddle here. The alternative using
.each()would look like tis:You can test that version here.