Modified js code and resolved jquery loading issue