HTML 유효성 검사를 무시하려면 JavaScript를 사용하여 버튼 클릭 시 속성을 제거할 수 있습니다.
일치하는 각 요소에서 속성을 제거하려면 removeAttribute()를 사용합니다.
<!DOCTYPE html>
<html>
<body>
<form>
First Name: <input type = "text" id = "fname" value = "Amit" required>
<input type = "radio" onclick = "dislay('fname')"><br>
</form>
<script>
function display(id) {
document.getElementById(id).value = document.getElementById(id).removeAttribute('required');
}
</script>
</body>
</html>