I'm trying to improvise and find a solution to change the language on my site. I created a script that checks if "/de" is part of the URL and shows / hides different elements depending on the result. So all the elements that have a translation exist two times and have the class "hidetranslation" assigned to them, which hide them. Depending on the URL, one of the elements (the one with the right language) gets shown by removing the class with the following script.
$(document).ready(function() {
if (window.location.href.indexOf('/de') > -1) {
$('#german').removeClass('hidetranslation');
} else {
$('#english').removeClass('hidetranslation');
}
});
Unfortunately, the script doesn't seem to work on every element. Is it possible that it only works on the first one it detects in the code with the matching ID and then stops working? How can I run it on the whole site and stop it from stopping?