I am selecting check box value but i want to print that value on the same page (without submitting).
<script type="text/javascript">
$(document).ready(function() {
var selected_value = []; // initialize empty array
$(".source:checked").each(function(){
//selected_value.push($(this).val());
alert($(this).val());
});
//alert(selected_value); //Press F12 to see all selected values
});
</script>
<input class="source" type="checkbox" name="type" value="4" />
<input class="source" type="checkbox" name="type" value="3" />
<input class="source" type="checkbox" name="type" value="1" />
<input class="source" type="checkbox" name="type" value="5" />
But above code does not seem to be working. How is it possible?
Aucun commentaire:
Enregistrer un commentaire