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.
- How to check a checkbox with jQuery?
- jQuery | :checkbox Selector
- How to check whether a checkbox is checked in jQuery?
- jQuery | change() with Examples
- How to change the element id using jQuery ?
- How to change an HTML element name using jQuery ?
- How to change the placeholder text using jQuery?
- How to change cursor style using jQuery ?
- How to change the background image using jQuery ?
- How to Change the Text of a Button using jQuery?
- Content editable change event in jQuery
- JQuery | Change the text of a span element
- How to change selected value of a drop-down list using jQuery?
- How to detect and change the content/style of a div 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.