Input Patterns

Input Patterns

Medium HTML HTML Forms 28 views
Explanation Complexity

Problem Statement

Create a username input that allows only letters and numbers (pattern).

Input Format

No input.

Output Format

Print the HTML code.

Constraints

Use pattern attribute.

Input / Output Format

Input Format
No input.
Output Format
Print the HTML code.
Constraints
Use pattern attribute.

Examples

Input:
Output:
(HTML code)

Example Solution (Public)

HTML
<!doctype html>
<html lang='en'>
<head>
  <meta charset='utf-8'>
  <meta name='viewport' content='width=device-width, initial-scale=1'>
  <title>meetcode</title>
</head>
<body>
  <form action='#' method='post'>
    <label>Username
      <input type='text' name='username' pattern='[A-Za-z0-9]+' required>
    </label>
    <button type='submit'>Save</button>
  </form>
</body>
</html>

Official Solution Code

<!doctype html>
<html lang='en'>
<head>
  <meta charset='utf-8'>
  <meta name='viewport' content='width=device-width, initial-scale=1'>
  <title>meetcode</title>
</head>
<body>
  <form action='#' method='post'>
    <label>Username
      <input type='text' name='username' pattern='[A-Za-z0-9]+' required>
    </label>
    <button type='submit'>Save</button>
  </form>
</body>
</html>
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.