I would like to do a validation via jQuery, to see if the client selected some RadioButton
It displays an alert if it has not been selected, but it still submits, should not.
HTML
<table id="RadioButtonList1" cellspacing="15" cellpadding="15">
<tr>
<td><input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="1" /><label for="RadioButtonList1_0">opc 01</label></td>
</tr><tr>
<td><input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="2" /><label for="RadioButtonList1_1">opc 02</label></td>
</tr><tr>
<td><input id="RadioButtonList1_2" type="radio" name="RadioButtonList1" value="3" /><label for="RadioButtonList1_2">opc 03</label></td>
</tr><tr>
<td><input id="RadioButtonList1_3" type="radio" name="RadioButtonList1" value="4" /><label for="RadioButtonList1_3">opc 04</label></td>
</tr><tr>
<td><input id="RadioButtonList1_4" type="radio" name="RadioButtonList1" value="5" /><label for="RadioButtonList1_4">opc 5</label></td>
</tr>
</table>
<input type="submit" name="Button1" value="Votar" id="Button1" class="btn btn-primary" />
JS
jQuery(function(){
jQuery('#Button1').bind('click',checkRadio);
})
function checkRadio() {
var isChecked = jQuery("input[name=fileType]:checked").val();
var booleanVlaueIsChecked = false;
if (!isChecked) {
booleanVlaueIsChecked = true;
alert('Selecione algum logotipo');
}
}