Welcome to WebmasterWorld Guest from 107.21.175.43

Forum Moderators: open

Message Too Old, No Replies

Google Translate creating validation errors

     

onlines

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

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

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

Featured Threads

Hot Threads This Week

Hot Threads This Month