How to check and uncheck a html checkbox using JQuery

H

How Can We Help?

We will use a checkbox with ID “myCheckbox” in this example

First to check a checkbox using JQuery use the following code, remember to replace “myCheckbox” with the ID of your checkbox

$('#myCheckbox').attr('checked','checked');

To un-check the checkbox use the following JQuery code, remember to replace “myCheckbox” with the ID of your checkbox

$('#myCheckbox').removeAttr('checked');

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me