jQuery | :checkbox Selector
The checkbox is a very important element to make interactions with a user. In JQuery, we can build a simple checkbox to allow data entry as well.
Syntax:
$(":checkbox")
We can implement the checkbox in the code:
Example:
<!DOCTYPE html> <html> <head> <script src= </script> <style> p { font-size: 20px } </style> <script> $(document).ready(function() { $(":checkbox").wrap( "<span style='background-color:green'>"); }); </script> </head> <body> <h2>Add your Hobbies:</h2> <p>Dancing: <input type="checkbox" name="hobbies" value="dancing"> <br> Painting: <input type="checkbox" name="hobbies" value="painting"> <br> Singing: <input type="checkbox" name="hobbies" value="singing"> <br> </p> </body> </html> |
chevron_right
filter_none
Output:

Recommended Posts:
- How to check whether a checkbox is checked in jQuery?
- jQuery | :gt() Selector
- jQuery | :lt() Selector
- jQuery | :not() Selector
- jQuery | * Selector
- jQuery | :odd Selector
- jQuery | :first Selector
- jQuery | :even Selector
- jQuery | :last Selector
- jQuery | #id Selector
- jQuery | :has() Selector with example
- jQuery | :contains() Selector
- jQuery | :radio Selector
- jQuery | animated Selector with Example
- jQuery | element + next Selector
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



