If you want to get multiple values of checkbox using jquery , Here is the code :
<html>
<head>
<style>
div { color:red; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<form>
<p>
<input type="checkbox" name="newsletter" value="Hourly" checked="checked">
<input type="checkbox" name="newsletter" value="Daily">
<input type="checkbox" name="newsletter" value="Weekly">
<input type="checkbox" name="newsletter" value="Monthly">
<input type="checkbox" name="newsletter" value="Yearly">
</p>
</form>
<div></div>
<script>
var checkedSiteValues = ""
var count = 0;
$("input[name ='newsletter']:checked").each(function() {
var check = $(this).val();
if (check != "true") {
count++;
if (count == 1) {
checkedSiteValues = $(this).val();
} else {
checkedSiteValues = checkedSiteValues + "," + $(this).val();
}
}
alert(checkedSiteValues);
});
</script>
</body>
</html>
<html>
<head>
<style>
div { color:red; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<form>
<p>
<input type="checkbox" name="newsletter" value="Hourly" checked="checked">
<input type="checkbox" name="newsletter" value="Daily">
<input type="checkbox" name="newsletter" value="Weekly">
<input type="checkbox" name="newsletter" value="Monthly">
<input type="checkbox" name="newsletter" value="Yearly">
</p>
</form>
<div></div>
<script>
var checkedSiteValues = ""
var count = 0;
$("input[name ='newsletter']:checked").each(function() {
var check = $(this).val();
if (check != "true") {
count++;
if (count == 1) {
checkedSiteValues = $(this).val();
} else {
checkedSiteValues = checkedSiteValues + "," + $(this).val();
}
}
alert(checkedSiteValues);
});
</script>
</body>
</html>