Element p not allowed as child of element dl in this context. (Suppressing further errors from this subtree.)

StackOverflow https://stackoverflow.com/questions/21401413

Pregunta

I'm getting following error when validating with W3C.

"Error: Element p not allowed as child of element dl in this context. (Suppressing further errors from this sub tree.)".

Does anyone knows how to fix this?

<dl>

    <dt>Comments</dt>
    <dd class="auto">
      <textarea name="cus-other-info" cols="45" rows="5" id="cus-other-info-id"></textarea>
    </dd>



    <p class="cap">ReCAPTCHA entry is for testing whether you are a human visitor and to prevent automated spam submissions.</p>
    <dd class="auto recaptcha">
    <div class="recaptcha-item">
      <script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6LfaXscSAAAAAMcN5Mfvza9CyYfV7K5__BbQiPBN"></script>

<noscript>
    <iframe src="http://www.google.com/recaptcha/api/noscript?k=6LfaXscSAAAAAMcN5Mfvza9CyYfV7K5__BbQiPBN" height="300" width="500" frameborder="0"></iframe><br/>
    <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
    <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>                </div>
    </dd>
    <p><sup class="required">*</sup> = Required Fields</p>
    <dd class="auto recaptcha">
        <div class="submit-item">
     <input type="button" class="reset-but" value="Reset" onclick="clearContForm();" />
      <input type="button" class="submit-but" value="Submit" onclick="formSubmit();" />
      </div>
    </dd>

   </dl> 
¿Fue útil?

Solución

From the respective MDN docu:

Permitted content Zero or more <dt> elements, each followed by one or more elements.

Your <p> tags are not wrapped with a <dl> or <dt> tag. If you change this, your code will validate.

Besides, I recommend using the tags, for what they are thought for. Again citing MDN:

The HTML <dl> Element (or HTML Description List Element) encloses a list of pairs of terms and descriptions. Common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs).

From the above code, I assume you are just using this for layout and/or styling purposes.

Otros consejos

<p><sup class="required">*</sup> = Required Fields</p>
<dd class="auto recaptcha">

this p is not inside of dd. Either move it inside of dd, or close previous dl, output this p and open new dl. Same goes for

<p class="cap">ReCAPTCHA entry is for testing whether you are a human visitor and to prevent automated spam submissions.</p>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top