sajesh Nambiar
sajesh Nambiar

Reputation: 699

Data-bind visible knockout.js with OR

I am doing an OR check for the visibility of a control but it is not working as expected. Below is the code for the same.

<span data-bind="visible: (test1()==='a' || test() === 'a')>a</span>

var viewModel = {
test : ko.observable('a'),
test1 : ko.observable('a')
};

 ko.applyBindings(viewModel); 

Upvotes: 1

Views: 924

Answers (1)

Ananthan Unni
Ananthan Unni

Reputation: 1304

You have not closed the quotes in your data-bind attribute value.

<span data-bind="visible: (test1()==='a' || test() === 'a')**"**>a</span>

The closing " was missing

Fiddle here

Upvotes: 2

Related Questions