<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<input type="text" required>
<input type="text" required>
<input type="text" required>
<input type="text" required>
<input type="text" required>
<input name="" type="button" value="Go">
<script>
document.querySelector('[type="button"]').addEventListener( "click" , function(event) {
event.preventDefault();
if(document.querySelectorAll('[type="text"]:invalid').length)
alert("одно или несколько полей незаполнено");
else location = "https://ya.ru";
});
</script>
</body>
</html>
|