moved onclick behavior from html to js