Let me give few examples around it. Below is the sample HTML and script. Code is very simple and self explanatory. However, to make it more clear, I have also put comments around the same. Also, while writing the same, you can see below screenshot, editor is helping at every point. I am using webstorm here. You can use any of your favorite editors.
2,005 total views, 1 views today