C#:
this is the html
<div>
<input type="checkbox" name="skills" value="js" />JS
<input type="checkbox" name="skills" value="jQuery" />jQuery
<input type="checkbox" name="skills" value="C#" />c#
<input type="checkbox" name="skills" value="VB" />VB
<br /><br />
<input id="btn1" class ="btn btn-outline-info" type ="submit" />
<div id="result1">
</div>
</div>
this is in the site.js file
$(document).ready(function () {
$('#btn1').click(function () {
var result = $('input[type="checkbox"]:checked');
if (result.length > 0) {
var resultString = result.length + " checkbox checked <br/>";
result.each(function () {
resultString += $(this).val() + "<br/>";
});
$('#result1').html(resultString);
}
else {
$('#result1').html("none selected");
}
});
})
the output should be something like this :
none selected , if no checkbox is selected and like this
if checkbox are selected.
there is no output if the submit button is clicked. I am not sure what is wrong in the code.