2

I'm a little confused as to what is considered valid markup for HTML5 input fields.

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Site Name</title>
</head>

<body>

    <form name="contact" method="post" action="/">
       <p><input type="input" name="first_name" maxlength="255" /></p>
    </form>

</body>

</html>

When I run this through the validator at w3.org I get the error Bad value input for attribute type on element input. with the /> highlighted in red. I look at the HTML-Tidy version it creates and it tells me to write it like this instead:

<p><input type="input" name="first_name" maxlength="255"></p>

But then when I validate that I then get the same error but with just the > highlighted in red. Then looking at the HTML-Tidy to see what it has corrected it to and it leaves is the same as if it's okay, but the error is still there. Is this considered valid HTML5 markup? Or is there a specific way of doing this?

2 Answers 2

5

type="input" is an invalid value of the attribute type of the input element.

This guide on the input element shows the allowed type attributes. Or check the HTML5 additional input types if you require one of those.

For a regular textfield you need to set the type attribute to type="text".

Sign up to request clarification or add additional context in comments.

Comments

2

Input type "input" is not correct, you probably intented to use type="text".

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.