覆盖 HTML5 验证
要忽略 HTML 验证,可以使用 JavaScript 在按钮单击时删除 attribute。
Uer removeAttribute() 从每个匹配元素中删除一个 attribute。
<!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>
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP