Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to uncheck a checkbox using jQuery without triggering click event

Tags:

jquery

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();" />
like image 843
Mathematics Avatar asked Oct 30 '25 16:10

Mathematics


2 Answers

You can use .prop():

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

//check
$("#someID").prop("checked",true);
like image 107
Felix Avatar answered Nov 02 '25 05:11

Felix


Please try with the below code snippet.

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

//Un-check
$("#someID").prop("checked",false);
like image 40
Jayesh Goyani Avatar answered Nov 02 '25 05:11

Jayesh Goyani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!