:checkbox Selector - Javascript jQuery Selector

Javascript examples for jQuery Selector:checkbox

Description

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>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $(":checkbox").wrap("<span style='background-color:blue'>");
});/*  ww w. j av a2s . co  m*/
</script>
</head>
<body>

<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">
</form>

</body>
</html>

Related Tutorials