// Generic Jquery Loop var i; for (i = 0; i < substr.length; ++i) { // do something with `substr[i]` }