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: