Last active
July 14, 2017 08:58
-
-
Save zy108830/6dfe8e28b013f5445476 to your computer and use it in GitHub Desktop.
setCustomValidity,html5,required,radio
This file contains hidden or 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
<form> | |
<input type="radio" id="test" name="test" value="0" oninvalid="this.setCustomValidity('Click me')" onclick="clearValidity();" required>Zero<br> | |
<input type="radio" name="test" value="1" onclick="clearValidity()" class="wrapper">One <br> | |
<input type="radio" name="test" value="2" onclick="clearValidity()" class="wrapper">Two <br> | |
<input type="submit"> | |
</form> | |
<script> | |
function clearValidity(){ | |
document.getElementById('test').setCustomValidity(''); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment