Error message in validator html

hi guys,
i have problem with css.
i try to validate my html page,and i get error:

     jQuery("#dropmenu li:has(ul) a").append("<span> »</span>"); 

:email:

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements – such as a “style” element in the “body” section instead of inside “head” – or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML’s rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML’s “self-closing” tags for “meta” and “link” in the “head” section of a HTML document may cause the parser to infer the end of the “head” section and the beginning of the “body” section (where “link” and “meta” are not allowed; hence the reported error).

howcan i fix it ?
thanks.
Roi

Actually the downlevel revealed comments should be like this.


[B]<!--[if !IE]>-->[/B]

<p>Stuff for non IE </p>

[B]<!--<![endif]-->[/B]


Hi Roi, and welcome to SitePoint! :slight_smile:

Unless I’m mistaken, I’d say your problem is here:

li:has(ul)

I’ve never seen a pseudo class called :has(ul). What do you actually have in your HTML?

That’s the jquery :has selctor Ralph :slight_smile:

Thanks Paul. Must get back into that Ninja book. Only ever got to about p30 before being distracted.

Hi,

The error is because you haven’t commented the javascript out with cdata comments etc and the js is being read as html.

However it is much easier and safer to simply move the javascript to an external file and it will validate.

THANKS !!
THNAKS !!!

and… THANKSS !!
WORK!

Your code is full of

<![endif]>

that should be

<![endif]–>

this is the html problem:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml” dir=“ltr” lang=“de” >
<head>
<title><?php wp_title(‘«’, true, ‘right’); ?></title>
<meta http-equiv=“Content-Type” content=“<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘charset’); ?>” />
<link rel=“shortcut icon” type=“image/ico” href=“<?php bloginfo(‘template_directory’); ?>/favicon.ico” />
<!-- leave this for stats –>

<!–[if ! (IE)]>
<link rel=“stylesheet” href=“<?php bloginfo(‘stylesheet_url’); ?>” type=“text/css” media=“screen” />
<![endif]>

<!–[if IE 7]>
<link rel=“stylesheet” href=“http://www.rubbellose365.de/wp-content/themes/rubellose/style55.css” type=“text/css” media=“screen” />
<![endif]>

<link rel=“alternate” type=“application/rss+xml” title=“<?php bloginfo(‘name’); ?> RSS Feed” href=“<?php bloginfo(‘rss2_url’); ?>” />
<link rel=“pingback” href=“<?php bloginfo(‘pingback_url’); ?>” />

<!–[if IE]>
<style type=“text/css”>
#bb{
height:30px;
margin-top:35px;
}
</style>
<![endif]–>

<![if !IE]>
<style type=“text/css”>

#bb{
height:30px;
margin-top:65px;
}
</style>

<![endif]>

thanks.

Hi,

Can use post the html that you are trying to validate. Conditional comments will pass validation fine so you must have a typo either in the comments or perhaps before the comments triggering an error somewhere else.

There’s not enough for me to go on in the above post really.

hi guys,
thanks about your comment, now i check if womethiong will help me,
i have more 1 question.

Q:i have condition in css.
i get error when i try to do validition.
the error is:

Error Line 13, Column 5: invalid comment declaration: found delimiter “[” outside comment but inside comment declaration

<!–[if IE 7]>

:email:

Info Line 9, Column 1: comment declaration started here

<!–[if ! (IE)]>

Error Line 13, Column 6: character data is not allowed here

<!–[if IE 7]>

:email:

You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include:

* putting text directly in the body of the document without wrapping it in a container element (such as a &lt;p&gt;aragraph&lt;/p&gt;), or
* forgetting to quote an attribute value (where characters such as "&#37;" and "/" are common, but cannot appear without surrounding quotes), or
* using XHTML-style self-closing tags (such as &lt;meta ... /&gt;) in HTML 4.01 or earlier. To fix, remove the extra slash ('/') character. For more information about the reasons for this, see Empty elements in SGML, HTML, XML, and XHTML.

Error Line 15, Column 4: “endif” is not a reserved name

<![endif]>

how can i fix it ?

thanks.