IE不尊重< label>在< anchor>内 [英] IE doesn't respect <label> within <anchor>
问题描述
< a target =_ blankhref =http://www.google.comonclick =console。日志('你点了我')>
< label>我是第一个标签< / label>
< label>看看@我,我是第二!< / label>
< / a>
当我潜入这个奇怪的主题时,我发现标签之间的空白符合相应的行为。只有当我徘徊在标签之外时,我的能力才会消失。
所以......解决方案是什么?
使用跨度...就是这样...
< a target =_ blankhref =http://www.theonion.comonclick =console.log('you clicked me')>
< span>我是另一个第一个标签< / span>
< span>看@我,我是另一秒!< / span>
< / a> b
$ b nofollow> http://jsfiddle.net/bdGPB/1/
So I just found out that IE (even the current 10 & 11) do not support labels within anchor tags...but DOES support onclick actions within said tag. Ran into this when I was updating a menu system and wanted to use labels to separate the menu description from the associated shortcut. The 'redirect/processing' modal window comes up fine, but then things just sat there.
<a target="_blank" href="http://www.google.com" onclick="console.log('you clicked me')">
<label>I am a first label</label>
<label>Look @ me, I'm second!</label>
</a>
As I dived into this strange topic, I found that the whitespace between the labels behaved appropriately...only when I hovered over the label did my ability to href outta here went away.
So...what's the solution?
解决方案 Use spans...that's it...
<a target="_blank" href="http://www.theonion.com" onclick="console.log('you clicked me')">
<span>I am another first label</span>
<span>Look @ me, I'm another second!</span>
</a>
这篇关于IE不尊重< label>在< anchor>内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!