:checkbox Selector - Javascript jQuery Selector

Javascript examples for jQuery Selector:checkbox


The :checkbox selector selects input elements with type=checkbox.

The following code shows how to select all <input> elements with type="checkbox":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    $(":checkbox").wrap("<span style='background-color:blue'>");
});/* w  w w.  java2s  .c o m*/

<form action="">
  Name: <input type="text" name="user"><br>
  bike: <input type="checkbox" name="vehicle" value="Bike"><br>
  car: <input type="checkbox" name="vehicle" value="Car"><br>
  <input type="submit">


Related Tutorials