Q:

Finds all elements that are checked or selected using jquery

0

Finds all elements that are checked or selected using jquery

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Finds all elements that are checked or selected.</title>
</head>
<body>
<form>
<input type="checkbox" name="color" value="Bike">Red
<input type="checkbox" name="color" value="Car">Green
<input type="checkbox" name="color" value="Car">Blue
<input type="checkbox" name="color" value="Car">Black
</form>
<p></p>
</body>
</html>

JavaScript Code :

var count_Checked = function() {
var n = $( "input:checked" ).length;
$( "p" ).text( n + (n === 1 ? " is" : " are") + " checked." );
};
count_Checked();
$("input[type=checkbox]" ).on( "click", count_Checked );

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now