We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set and Get CheckBox value programmatically with Jquery

Thread ID:





119764 Jul 28,2015 10:15 AM UTC Jul 29,2015 11:38 AM UTC JavaScript 2
Tags: ejCheckBox
Asked On July 28, 2015 10:15 AM UTC

With other syncfusion controls, when I have to assign them a value, when the view is first loaded I do something like this:

(this is an example with control maskedit)


-> this approach doesn't work with checkbox:

            value: '@Model.Interaction_Flag'

..and this doesn't work either:

            checked: '@Model.Interaction_Flag'

Also, about recovering a value (for example to prepare the JSON for an ajax call), I usually do something like this:

Person_Surname: $('#Surname').val()

with checkboxes I have tried the following, which doesn't work:

Interaction_Flag: $('#CustomCheck').val()

..and this doesn't work either:

Interaction_Flag: form.find('#CustomCheck').checked()

More generally speaking, what is the general best approach to handle these GET / SET scenarios with syncfusion controls? Thanks

Replied On July 29, 2015 08:10 AM UTC

Just a quick upgrade; at the moment I solved the issue doing the following - very ugly - solution:

  • I declare the control like this: (1)
<input type='checkbox' id='CheckBox' />
  • Then I set it to be an ejCheckBox and recover the value from the model this way: (2)

            checked: @Json.Encode(@Model.Interaction_Flag),

  • Finally, when I need to get the checkbox value (to prepare a JSON), I do this (which is the ugly part): (3)

Regarding this last part (3), I also tried to do this:


but that fails to get the correct checkbox value if the checked state was set to true by the code at (2) and not by the user. I'd really like to know if I'm following the best approach to handle the scenario, especially regarding the code at (3), which seems to be very ugly (isn't _isChecked a private property after all?)

Sasikala Nagarajan [Syncfusion]
Replied On July 29, 2015 11:38 AM UTC

Hi Carlo,

Thanks for using Syncfusion products,

We can get and set the check box checked state using checked property(Boolean type – true/false).

Please refer the below code snippet to set the value to checkbox at that time of initialization.
<input type="checkbox" id="check1" />


We can get the check box’s checked state from object of the checkbox. Please refer the below code snippet to get the checked state of ejcheckbox
obj = $("#check1").ejCheckBox('instance');

Please refer the below link to know more about possible methods to get and set the properties of ej controls


We have prepared the simple sample based on this. Please refer the below link

Please check with given links and let us know if you have further queries,


Sasikala Nagarajan


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon