radio button - difference between value and checkedValue

63 views
Skip to first unread message

Norma Mendonca

unread,
Aug 13, 2016, 8:18:09 AM8/13/16
to KnockoutJS
Hi,

I am trying to understand the difference between 'value' and 'checkedValue' in a radiobutton/checked binding.

    <div id="div-2">
        <!-- ko foreach: items -->
        <input type="checkbox" data-bind="checkedValue: $data, checked: $root.chosenItems" />
        <span data-bind="text: $data"></span>
        <!-- /ko -->
        <div data-bind="text: ko.toJSON($root)"></div>
    </div>

            var viewModel = {
                items: [1,2,3,4,5,6],
                chosenItems: ko.observableArray(["6"])
            }

            ko.applyBindings(viewModel, $("#div-2")[0]); 

Looks like both 'value' and 'checkedValue' do the same thing.

Regards
Norma

Michael Best

unread,
Aug 15, 2016, 1:30:34 PM8/15/16
to KnockoutJS
Reply all
Reply to author
Forward
0 new messages