If the checkbox is cheked then only i see the value else not on submit what am i doing wrong
<form>
<input type="checkbox" id="tagdata" name="tagdata" onchange="get_checkbox_value();" value="0"/>
</form>
function get_checkbox_value()
{
if ($('#tagdata').attr('checked')) {
$('#tagdata').val('1');
}
else
{
$('#tagdata').val('0');
}
}
I’m not sure exactly what you’re asking, but checkbox values are only submitted if the checkbox is ticked/crossed. If a value is submitted then the user has selected the checkbox, if no value is submitted then it is not checked.