Jump to content

Problems translating radio in forms

Recommended Posts

Hello,

 

I have tried everything in my power to translate the Strongy Disagree, Disagree, Neutral, Agree and Strongly Agree in a form.

The First Name and Last Name does the trick, but the rest still stays the same.

I have used the following code snippet into Header:

<script>
function addLoadEvent(func) {
 var oldonload = window.onload;
 if (typeof window.onload != 'function') {
   window.onload = func;
 } else {
   window.onload = function() {
     if (oldonload) {
       oldonload();
     }
     func();
   }
 }
} 
addLoadEvent(function() {  
 sqsFirstName = document.getElementsByClassName("caption")[0].innerHTML;
 myFirstName = sqsFirstName.replace("First Name", "Fornavn");
 document.getElementsByClassName("caption")[0].innerHTML = myFirstName;

 sqsLastName = document.getElementsByClassName("caption")[1].innerHTML;
 myLastName = sqsLastName.replace("Last Name", "Etternavn");
 document.getElementsByClassName("caption")[1].innerHTML = myLastName;

 sqsRadio = document.getElementsByClassName("option")[-2].innerHTML;
 myRadio = sqsRadio.replace("Strongly Disagree", "Veldig uenig");
 document.getElementsByClassName("option")[-2].innerHTML = myRadio;

 sqsRadio = document.getElementsByClassName("option")[-1].innerHTML;
 myRadio = sqsRadio.replace("Disagree", "Uenig");
 document.getElementsByClassName("option")[-1].innerHTML = myRadio;

 sqsRadio = document.getElementsByClassName("option")[0].innerHTML;
 myRadio = sqsRadio.replace("Neutral", "Nøytral");
 document.getElementsByClassName("option")[0].innerHTML = myRadio;

 sqsRadio = document.getElementsByClassName("option")[1].innerHTML;
 myRadio = sqsRadio.replace("Agree", "Enig");
 document.getElementsByClassName("option")[1].innerHTML = myRadio;

 sqsRadio = document.getElementsByClassName("option")[2].innerHTML;
 myRadio = sqsRadio.replace("Strongly Agree", "Veldig enig");
 document.getElementsByClassName("option")[2].innerHTML = myRadio;  
});
</script>

 

Thank you in advance for any help!

Link to comment
  • Replies 0
  • Views 167
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.