changed code into jquery