Reputation: 7628
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();" />
Upvotes: 4
Views: 4510
Reputation: 1
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.
Upvotes: 0
Reputation: 38112
You can use .prop():
//Un-check
$("#someID").prop("checked",false);
//check
$("#someID").prop("checked",true);
Upvotes: 10
Reputation: 235
Please try this:
$('input[id$="someID"]').prop('checked', false);
Upvotes: 0
Reputation: 17366
Since it's asp.net you can use .prop()
along with the following script
$('#<%=someID.clientID %>').prop('checked',false);
Upvotes: 0
Reputation: 11154
Please try with the below code snippet.
//check
$("#someID").prop("checked",true);
//Un-check
$("#someID").prop("checked",false);
Upvotes: 2