IE不尊重< label>在< anchor>内 [英] IE doesn't respect <label> within <anchor>

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

问题描述

因此,我发现IE(甚至当前的10和11)不支持锚标签内的标签......但是支持在所述标签内的点击操作。当我更新一个菜单系统并想使用标签将菜单描述与关联的快捷方式分开时,可以进入此操作。 '重定向/处理'模式窗口显示正常,但事情只是坐在那里。

 < 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>

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

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

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