Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Override HTML5 validation
To ignore HTML validation, you can remove the attribute on button click using JavaScript.
Uer removeAttribute() to remove an attribute from each of the matched elements.
<!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> Advertisements
