Fixes an IE 8 issue caused by a for..in loop

Iterate over a jQuery object using `$.each` instead of a `for..in` loop, which was causing an issue in IE 8 and lower.