Checkbox checked value does not change

1 Answer 2519 Views
General Discussions
Rubencito
Top achievements
Rank 1
Rubencito asked on 15 Jul 2016, 04:38 AM

Help here, the checked value of Kendo Checkbox does not change and is always assigned as 'true'. Below is the sample code:

@(Html.Kendo().CheckBox().Name("autoValidate")
    .Checked(false)
    .Label("Auto-Validate")
    .HtmlAttributes(new { onchange = "updateMsg();" })
)
 
<blockquote>
    autoValidate checked value: <span id="autoValidate-value"></span>
</blockquote>
 
<script type="text/javascript">
    function updateMsg() {
        $('#autoValidate-value').text($('input[name=autoValidate]').val());
    }
 
    updateMsg();
</script>

1 Answer, 1 is accepted

Sort by
0
Accepted
Vessy
Telerik team
answered on 18 Jul 2016, 03:13 PM
Hi Rubencito,

Indeed the html value of the checkbox does not change, but you can access the changed value in a similar way:
function updateMsg() {
    $('#autoValidate-value').text($("#autoValidate").is(':checked'));
}

Hope this helps.

Regards,
Vessy
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Rubencito
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or