Changed js code to jquery