You have some weird hidden characters in that line of HTML. specifically, before the closing " of the onclick and after the opening " of the style.
You can fine them if you move through the line of HTML with the right arrow key.
Here is your HTML pasted into a simple word processor:
<a onclick="alert(1)" style="text-decoration: underline;">111</a>
<a onclick="alert(1)" style="text-decoration: underline;">111</a>
<a onclick="alert(1)" style="text-decoration: underline;">111</a>
<a onclick="alert(1) " style=" text-decoration: underline;">111</a>
<a onclick="alert(1)" style="text-decoration: underline;">111</a>
3
solved onclick not working for few anchor tags