0

I click <a>, it shows its id, but if I click the <a> again, it shows alert()twice, if I click it again, it shows alert() 3 times and it goes like that. How can I prevent repeating itself?
<a id="5" class="accRoom" onclick="dynamicLink()">5</a>
<a id="6" class="accRoom" onclick="dynamicLink()">6</a>