It correctly shows the text. If it truely only matches once, then wouldn’t the second href not fire the event and take you wherever the href is taking you to?
I just want to give you a little start with HTML and javascript.
Regarding w3c HTML attribute ID needs to be UNIQUE on whole page. That means when you use method document.getElementById(id) first element will be returned because there should be only one with that id. jQuery works same way. Why should they create functionality for invalid HTML.
But I know what is your need, so I will try to help you.
You can add another attribute to your element for example attribute “rel” and assign action to all elements with rel attribute and with specific value of that attribute. Example is below:
When you start breaking the rules you can’t tell what will happen. With that code you could get five different outcomes from five different browsers if each implemented their code in a different way.
How any getElementById processing will work with that code is undefined since such a combination is not allowed in valid HTML and so browsers can do whatever they like with it.