The knockoutjs function allows you to work when we have code similar to this
At the beginning, both links are active. If you click on any one link, it will disable the other. If you click the link again, it activates another link.
This is not the answer you are asking for .. here is the answer that allows you to work with knockout
You want to enable only one button, then there must be some condition, apply these conditions with this inclusion binding, so that all problems are resolved.
Html: -
<input type="text" data-bind="enable: linkTwo() != 'clicked',click: clickActivateSpatialSearch" id='draw_polygon'/> <input type="text" data-bind="enable: linkOne() != 'clicked',click: clickActivateSpatialSearchBox" id='draw_box'/>
Script: -
var self = this; self.linkOne = ko.observable(); self.linkTwo = ko.observable(); self.clickActivateSpatialSearch = function(){ if(self.linkOne() != 'clicked'){ self.linkOne('clicked'); } else{ self.linkOne('notClicked'); }
Note: enabling and disabling snapping will not work for tag snapping. It works for input, textarea, Select ..
source share