x
 
<!DOCTYPE html>
<html>
<body>
<h1>input pattern 属性</h1>
<form action="/demo/action_page.php">
  <label for="country_code">国家代码:</label>
  <input type="text" id="country_code" name="country_code" pattern="[A-Za-z]{3}" title="三字母国家代码"><br><br>
  <input type="submit">
</form>
<p><strong>注释:</strong>Safari 10(或更早版本)不支持 input 标签的 pattern 属性。</p>
</body>
</html>