change to jquery each function