Let's say I want to replace all instances of options on a form (Agree/Disagree/Neutral). I can't seem to make this happen for any more than the first instance of each, rather than down the entire page.
Example
Here is where I'm at so far:
<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() {
//Songwriting
sqsRadio = document.getElementsByClassName("option")[0].innerHTML;
myRadio = sqsRadio.replace("Strongly Disagree", "Fortement Désaccord");
document.getElementsByClassName("option")[0].innerHTML = myRadio;
sqsRadio = document.getElementsByClassName("option")[1].innerHTML;
myRadio = sqsRadio.replace("Disagree", "Désaccord");
document.getElementsByClassName("option")[1].innerHTML = myRadio;
sqsRadio = document.getElementsByClassName("option")[2].innerHTML;
myRadio = sqsRadio.replace("Neutral", "Neutre");
document.getElementsByClassName("option")[2].innerHTML = myRadio;
sqsRadio = document.getElementsByClassName("option")[3].innerHTML;
myRadio = sqsRadio.replace("Agree", "d'Accord");
document.getElementsByClassName("option")[3].innerHTML = myRadio;
sqsRadio = document.getElementsByClassName("option")[4].innerHTML;
myRadio = sqsRadio.replace("Strongly Agree", "Fortement d'Accord");
document.getElementsByClassName("option")[4].innerHTML = myRadio;
});
</script>