IE不尊重& amp; lt; label& gt;在& lt; anchor& gt;之内 [英] IE doesn't respect <label> within <anchor>

查看:82
本文介绍了IE不尊重& amp; lt; label& gt;在& lt; anchor& gt;之内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我刚刚发现IE(即使是当前的10和11)也不支持锚标记内的标签...但是支持该标记内的onclick动作.当我更新菜单系统并想使用标签将菜单说明与关联的快捷方式分开时,请执行此操作.重定向/处理"模态窗口很好,但随后事情就停在那里了.

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>

http://jsfiddle.net/bdGPB/1/

这篇关于IE不尊重&amp; amp; lt; label&amp; gt;在&amp; lt; anchor&amp; gt;之内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆