converting javascript to jquery

updating