I want to add attribute class='notranslate' in <pre> to prevent Google Translating content in <pre> tag.
I use this JavaScript, and it work.
<script type='text/javascript'>
//<![CDATA[
var pre = document.getElementsByTagName("PRE")[0];
var att = document.createAttribute("class");
att.value = "notranslate";
pre.setAttributeNode(att);
//]]>
</script>
But there is problem. That's JavaScript only work at first <pre> tag.
Anyone can help me, how to Add class='notranslate' in entire tag <pre> ?
Thank you and sorry for my english.
var preis a list of nodes. Loop through them and set your attribute to all if them.$('pre').addClass("notranslate");