js code is rewritten using jQuery framework