Disable anchor tag in knockout.js
html, javascript, knockout.js
Solution
Anchor tags cannot be disabled. The easiest is to use `ko if binding` and then render a `span` instead of the `anchor` if the skype id is null
<!-- ko if: skypeId === null -->
<span >No Skype Id</span>
<!-- /ko -->
<!-- ko if: skypeId !== null -->
<a id="aQStreamSkype" data-bind="attr:{href: ''}, click: $parent.StoreUserClick,text: skypeId"></a>
<!-- /ko -->
Here is a fiddle
Problem
I need to disable the anchor tag inside a foreach loop of knockout.js in HTML. Here is my code: ``` <a id="aQStreamSkype" data-bind="attr:{href: ''}, click: $parent.StoreUserClick,disable: ($data.SkypeId == 'null')">Skype </a> ```