Use jQuery to get values of selected checkboxes?

Yes, we can use jQuery to get values of selected checkboxes using the concept of input. We have to also use the :checked selector.

Example

Following is the code −



   
   
   Document





   
   
   
   



To run the above program, save the file name anyName.html(index.html) and right click on the file. Select the option “Open with live server” in VS Code editor.

This will produce the following output −

Now, select the checkbox −

This will produce the following output on console −

Updated on: 2020-10-26T10:56:01+05:30

493 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements