Reputation: 199
In WordPress I am using this code in my functions echo "<script type=\"text/javascript\">
which causes this XHTML validator error:
"an attribute value must be a literal unless it contains only name characters"
I need this to be in my functions in WordPress, but also to be XHTML valid. I don't know much about any kind of coding, I'm a CSS and HTML junkie. Any help/
EDIT: REST OF THIS SECTION OF CODE:
if ($toggle == "no"){
echo '<link rel="stylesheet" href="'.get_template_directory_uri().'/tagmap.css" type="text/css" media="screen" />';
echo "\n\n";
echo "<script type=\"text/javascript\">
jQuery(document).ready(function() {
jQuery('ul.links li.hideli').hide();
jQuery('ul.links li.morelink').show();
jQuery('a.more').click(function() {
jQuery(this).parent().siblings('li.hideli').slideToggle('fast');
jQuery(this).parent('li.morelink').remove();
});
});
</script>\n\n";
Upvotes: 0
Views: 237
Reputation: 7913
You are trying to validate <script type=\"text/javascript\">
, which is invalid... the validation service highlights the slash character for you at column 14. You cannot have a slash character before the open quote starts in type=
.
Check the HTML source of your page which is what the validator is actually checking... line 21 Column 14 is where your Google Analytics code starts, not the jQuery code.
Line 20: <!-- Google Analytics -->
Line 21: <script type=\"text/javascript\">
You need to remove the slashes here.
Upvotes: 1