Home > Software design >  required attribute in <textarea> doesn't work in chrome. It is a chrome's bug or I m
required attribute in <textarea> doesn't work in chrome. It is a chrome's bug or I m

Time:06-27

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!

CodePudding user response:

This code works fine in Firefox, Chrome. Maybe try removing the / in /> for the element input as we don't need it for input elements.

Remember to upvote this answer if it solves the problem.

CodePudding user response:

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.

  • Related