To make the small story even more smaller, I suggest open web console (press f12) in a new tab in your browser and run the following script code:
document.write('<a>OUTER LINK<a>INNER LINK</a><</a>');
After you have run the code, inspect the DOM.
What did you find? Did the nested anchor tag got created?
Let me tell you the answer. NO
The actual DOM structure is as follows:
What did you find? Did the nested anchor tag got created?
Let me tell you the answer. NO
The actual DOM structure is as follows:
Remember if you do the following, still it is not going to work:
document.write('<a>OUTER LINK<div><a>INNER LINK</a></div></a>');
Now the DOM structure created is:
In w3 specification it is mentioned:
Links and anchors defined by the A element may not be nested.