Created
August 27, 2021 04:52
-
-
Save Rameshwar-ghodke/35f555e654f0905c45ea10d1c08cb97a to your computer and use it in GitHub Desktop.
validation error message not showing proper for checkbox and radio button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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