Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php" method="get">
  Name: <input type="text" oninvalid="alert('Must contain 6 or more characters');" name="fname" pattern=".{6,}">
  <input type="submit" value="Submit">
</form>
<p>If you submit the input field with less than 6 characters, an alert message will occur.</p>
<p><strong>Note:</strong> The oninvalid event is not supported in Safari.</p>
</body>
</html>