jquery $.each replaced by for loop