4

Normally people complain about checkbox clicking not triggering any event but in my case it's opposite, I want to uncheck checkbox without triggering any click event on it.

This is my precious checkbox,

<asp:CheckBox ID="someID" runat="server" Text="myCheckBoxText" OnClick="DoSomething();" />
2
  • uncheck checkbox without triggering any click event on it does this mean at page load. Commented Apr 8, 2014 at 10:09
  • @Jai Nope, not at page load, it's when something happens in a dragable lists, I need to uncheck checkbox without click Commented Apr 8, 2014 at 10:10

5 Answers 5

10

You can use .prop():

//Un-check
$("#someID").prop("checked",false);

//check
$("#someID").prop("checked",true);
Sign up to request clarification or add additional context in comments.

Comments

2

Please try with the below code snippet.

//check
$("#someID").prop("checked",true);

//Un-check
$("#someID").prop("checked",false);

Comments

0

Since it's asp.net you can use .prop() along with the following script

$('#<%=someID.clientID %>').prop('checked',false);

Comments

0

Please try this:

$('input[id$="someID"]').prop('checked', false);

Comments

0

My experience with bootstrap 4.4.1 and jQuery 1.12.1 was that the click event got triggered on .prop("checked", ...) and .prop("indeterminate", ...). Thus the only reliable way to set the indeterminate state was with an ugly button alongside the checkbox or to set up an image box to change image with every click instead of the checkbox. Turning off the event handler did not work because it got triggered after it was turned back on again.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.