Select checked checkbox

Description

The following code shows how to select checked checkbox.

Example


<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){<!--   w w w .  j a  v a2s  .com-->
    alert($("input:checked").length);
});
</script>
</head>
<body>
    <form>
        <input type="button" value="Input Button"/>
        
        <input type="checkbox">java2s.com</input>
        <input type="checkbox" checked />
        <input type="checkbox" />
        <input type="file" />
        <input type="hidden" />
        <input type="image" />
        <input type="password" />
        <input type="radio" />
        <input type="reset" />
        <input type="submit" />
        <input type="text" />
        
        <select><option>Option<option/></select>
        <textarea></textarea>
        <button>Button</button>
    </form>
</body>
</html>

Click to view the demo





















Home »
  jQuery »
    jQuery Example »




Animation
DOM
Event
Form
List
Select
Style
Table
Utilities