Added js code to main.js from index.html