The Checkboxes are used to let a user select one or more options for a limited number of choices. The :checkbox selector selects input elements with type checkbox.
In the above syntax, basically the return value of the checked or unchecked checkbox is being assigned to the textbox. Below examples will illustrate the approach:
Example 1: Here the return value of the checkbox is assigned to the textbox with a function click() whenever the checkbox is clicked to check or uncheck, it assigns the respective return value into the textbox. So, if we want to assign a certain user-defined value in the textbox according to check then we can do that with the use of if/else statement.
Example 2: This example conatains more than one checkboxes.
- jQuery | :checkbox Selector
- How to check whether a checkbox is checked in jQuery?
- How to check a checkbox with jQuery?
- How to change selected value of a drop-down list using jQuery?
- HTML | DOM Input Checkbox value Property
- How to detect value change on hidden input field in JQuery ?
- How to change an element color based on value of the color picker value using onclick?
- How to change an element color based on value of the color picker value on click?
- How to style a checkbox using CSS?
- How to change the element id using jQuery ?
- How to change cursor style using jQuery ?
- How to change an HTML element name using jQuery ?
- How to Change the Text of a Button using jQuery?
- How to change the background image using jQuery ?
- How to detect and change the content/style of a div using jQuery ?
- How to change the placeholder text using jQuery?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.