Loading ...

Anchor click not working on having label inside it | CodeAsp.Net

Anchor click not working on having label inside it

0 (0votes)

I encountered with a piece of code today where anchor tag was having label tag inside it like this:

<a href="/targeturl" class="no-underline">
                Dummy Text

The issue with the above code was that the anchor click was not working in IE. The culprit for this issue was the "label" tag. The anchor semantics as per http://dev.w3.org/html5/pf-summary/text-level-semantics.html specifies this:

Content model:
Transparent, but there must be no interactive content descendant.

i.e anchor can't have any child with "Interactive content". As per http://dev.w3.org/html5/pf-summary/dom.html#interactive-content-0 

Interactive content is content that is specifically intended for user interaction. Following are the interactive content elements:

Since "label" is an interactive content element we can't have that in anchor tag. The solution was to go with "span" tag instead.


Comments (no comments yet)

Top Posts