Avoid the jQuery loop if possible