modify to deal with multiple elements

- index.html: use event listener
- js: multiple elements