覆盖HTML5验证
要忽略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>热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短