0

I'm getting errors when trying to validate this page in HTML5:

  • Unclosed element fieldset.
  • Stray end tag fieldset.
  • Unclosed element form.

For this block of html:

<form class="pure-form pure-form-aligned" id="submit_form_contact" novalidate>
        <fieldset>
            <div class="pure-control-group">
                <label for="name">Your Name:</label>
                <input id="name" type="text" placeholder="Name" name="name" required>
            </div>

            <div class="pure-control-group">
                <label for="email">Your Email:</label>
                <input id="email" type="email" placeholder="Email Address" name="email" required>
            </div>

            <div class="pure-control-group">
                <label for="email_text">Inquiry Type: </label>
                <select id="inquiry_dropdown" class="pure-input-1-2" name="inquiry">
                    <option>General</option>
                    <option>Sales & Marketing</option>
                    <option>Press & Editorial</option>
                </select>
            </div>

            <div class="pure-control-group">
                <label for="message" style="vertical-align: top;">Message:</label>
                <textarea id="message" type="text" placeholder="Enter message here..." name="message"></textarea>
            </div>                      

            <div id="errors" style="text-align: center; color: red;"></div>

                <button id="contact_submit" class="pure-button pure-button-primary" style="background-color: #003A70; float:right; margin-right: 35px;margin-top:15px;">Submit</button>
            </div>

        </fieldset>
</form>

... I can't figure out why. Everything seems to be closed properly. Can anyone spot anything I'm doing wrong?

4

1 回答 1

3

您的“contact_submit”按钮后有一个</div>,但没有对应<div>的 . 这导致解析器搞砸了。

我建议使用 Notepad++ 之类的代码编辑器——它的一个功能是标签匹配,如果标签不匹配,它可以很容易地告诉你。

于 2013-09-27T17:23:24.277 回答