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.
To disable a HTML anchor element with CSS, we can apply the pointer-events: none style. pointer-events: none will disable all click events on the anchor element. This is a great option when you only have access to class or style attributes. It can even be used to disable all the HTML links on a page.
The <a> nchor element is simply an anchor to or from some content. Originally the HTML specification allowed for named anchors ( <a name="foo"> ) and linked anchors ( <a href="#foo"> ).
The <a> tag doesn't have a disabled attribute, that's just for <input> s (and <select> s and <textarea> s). To "disable" a link, you can remove its href attribute, or add a click handler that returns false.
Read w3c Link and the-a-element
disable is not valid with anchor tags
instead you can do it by event.preventDefault()
$('a').click(function(event){ event.preventDefault(); });
Disabled is not a valid attribute for the anchor tag. Source : http://dev.w3.org/html5/html-author/#the-a-element
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With