Solution 1 :

There are multiple errors in your HTML code.


Firstly, you need to remove the name string on the <textarea> element.

I think you wanted to set the name attribute to something. In that case, you can use the code below.

<textarea name="name"></textarea>

Secondly, you have to remove all of the empty name and id attributes. So, all of these:

<input name="" id="" />

Can simply be removed.

<input />

So, in summary, you need to:

  1. Change the "name" text on the <textarea> element to be an attribute (and have a value).
  2. Remove all empty name and id attributes.

Solution 2 :

All the issues that have been pointed out are right. I strongly recommend you to use a linter within your IDE

Or check out sites like validator.w3.org where you can paste/upload/urled your code and it will analyze it.

Solution 3 :

Here is my corrected code which validates perfectly. Just in case someone runs into a similar issue in the future. Thanks everyone.

<div class="form">
  <form action="#">
    <div class="flexBox">
        <input type="text" placeholder="Your name">
        <input type="email" placeholder="Your email">
    </div>
        <input type="text" placeholder="Your subject">
        <textarea cols="30" rows="8" placeholder="Your message"> 
</textarea>
        <button type="submit">Send</button>
        </form>
    </div>

Problem :

How would I fix this code for it to be validated in html 5 correctly? When I test my page in Chrome, it shows the page correctly, but I am validating with errors…

<div class="form">
  <form action="#">
    <div class="flexBox">
      <input type="text" name="" id="" placeholder="Your name">
      <input type="email" name="" id="text" placeholder="Your email">
    </div>
    <input type="text" name="" id="" placeholder="Your subject">
    <textarea "name" id="" cols="30" rows="8" placeholder="Your message"> 
    </textarea>
    <button type="submit">Send</button>
   </form>
 </div>

Comments

Comment posted by Dai

What errors? (Other than non-unique

Comment posted by connexo

The errors tell you exactly what is wrong.

By