I'm using the awesome jQuery Cycle Plugin, with the pagerAnchorBuilder
to build some pager items, so the user is able to switch between images.
Here's my code.
jQuery(function() {
jQuery('#slider<?php the_ID(); ?>').cycle({
fx: 'fade',//scrollDown
pager: '#bullets<?php the_ID(); ?>',
pagerAnchorBuilder: function(idx, slide) {
return '<a href="#">&</a>';
}
});
});
All is working pretty good, except by the fact that the return
part gives me some problems with the W3C Validator..
Line 92, Column 31: document type does not allow element "a" here
return '<a href="#">&</a>';
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).
My DocType is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Many thanks if anybody had a clue about why this is happe开发者_如何学编程ning...
It just thinks that you're trying to insert an anchor element inside the script tag (or .js file), where it's invalid. Just ignore it, and remember that validation isn't everything. Your main goal is to make sure it works.
Edit: If you want to get a perfect validation and maybe even follow some good-practices, you can use the following:
return "<a href='#'>&<a>"
It uses html entities. Translated into html, it's <a href='#'>&<a>
. Here is a simple html entities reference if you want to learn more.
精彩评论