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?
- How to check a checkbox with jQuery?
- How to change the checkbox value using jQuery ?
- jQuery | :input Selector
- jQuery | :nth-of-type() Selector
- jQuery | :enabled Selector
- jQuery | element Selector
- jQuery | :last Selector
- jQuery | :button Selector
- jQuery | animated Selector with Example
- jQuery | :header Selector
- jQuery | #id Selector
- jQuery | .class Selector
- jQuery | :text Selector
- jQuery | :password Selector
- jQuery | :file Selector
- jQuery | :submit Selector
- jQuery | :checked Selector
- jQuery | :reset Selector
- jQuery | :selected 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.

