Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Rameshwar-ghodke/35f555e654f0905c45ea10d1c08cb97a to your computer and use it in GitHub Desktop.
Save Rameshwar-ghodke/35f555e654f0905c45ea10d1c08cb97a to your computer and use it in GitHub Desktop.
validation error message not showing proper for checkbox and radio button
// custom validation error message show with checkbox
<label class='error d_none'>This field is required'</label>
<script>
// script for onclick submit and check or uncheck checkbox, message will be display and hide
$('#app_sub_btn').on('click', function(){
if($("#terms_condition").prop('checked') == false){
$('#terms_condition_error').removeClass('d_none');
}else{
$('#terms_condition_error').addClass('d_none');
}
});
$('#terms_condition').on('click', function(){
if($("#terms_condition").prop('checked') == false){
$('#terms_condition_error').removeClass('d_none');
}else{
$('#terms_condition_error').addClass('d_none');
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment