homepage Welcome to WebmasterWorld Guest from 54.227.5.234
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Google Translate creating validation errors
onlines




msg:4291462
 2:13 pm on Apr 3, 2011 (gmt 0)

I am trying to add the following standard code to add google translate to my website but when i try to validate the page it is giving me errors.

Standard Code Provided on Google website -

<div style="text-align:right; padding-right:10px; ">

<div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en',
layout: google.translate.TranslateElement.InlineLayout.SIMPLE
}, 'google_translate_element');
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

</div>

Errors -
1. Line 272, Column 51: required attribute "type" not specified
<div id="google_translate_element"></div><script>
&#9993;
The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.
2.Line 279, Column 101: required attribute "type" not specified
…late.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
&#9993;
The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.
Can anyone help me how to solve this problem?

Thank You in advance.
Much appreciated

 

g1smd




msg:4291467
 2:33 pm on Apr 3, 2011 (gmt 0)

As it says in the error message, add type="text/javascript" to each <script> tag.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved