Search code examples
htmlgoogle-chromeattributestextarearequired

required attribute in <textarea> doesn't work in chrome. It is a chrome's bug or I missed something?


this is a test code :

<form method="post" action="somepage.php">
  <input type="text" name="test_input" required />
  <textarea name="test_textarea" required></textarea>
  <input type="submit" />
</form>

It works well in firefox, but not in chrome / edge. Hovering the let a message appears (the field is required), but not with the textarea.

thanks a lot!


Solution

  • The main purpose of required attribute is to run a validation when submitting, which works fine in both browsers.

    Chrome not showing the tooltip for <textarea> is a known bug.