“禁用"是锚标记的有效属性 [英] Is 'disabled' a valid attribute for an anchor tag
本文介绍了“禁用"是锚标记的有效属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有以下简单的代码段:
<a ng-disabled='true' ng-click="value1=123">点击我</a><button ng-disabled='true' ng-click="value2=123">点击我</button>=={{value1}}===={{value2}}==
正如您从小提琴中看到的:http://jsfiddle.net/basarat/czVPG/ 按钮不是clickable 和 ng-click(这只是一个 jquery on('click',function(){})
)不执行.但是它确实为锚标记执行.
- 是不是因为 disabled 不是锚标记的有效属性?
- 如果是这样,为什么当按钮不触发时,它仍然会触发 dom click 事件?
解决方案
Disabled 不是锚标记的有效属性.来源:http://dev.w3.org/html5/html-author/#the-一个元素
If I have the following simple code segment:
<div ng-app="myApp">
<a ng-disabled='true' ng-click="value1=123">click me</a>
<button ng-disabled='true' ng-click="value2=123">click me</button>
=={{value1}}==
=={{value2}}==
</div>
As you can see from the fiddle : http://jsfiddle.net/basarat/czVPG/ the button is not clickable and ng-click (which is simply a jquery on('click',function(){})
) does not execute. However it does execute for the anchor tag.
- Is it because disabled is not a valid attribute for an anchor tag?
- If it is why does it still trigger the dom click event when a button does not?
解决方案
Disabled is not a valid attribute for the anchor tag. Source : http://dev.w3.org/html5/html-author/#the-a-element
这篇关于“禁用"是锚标记的有效属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文