I'm a little stuck, please help.
<script>
var language = '#LanguageCode#-#CountryCode#';
if(language === 'en-gb'){
document.getElementsByClassName('apple')[0].innerHTML = '<img src="english-apple.svg"/>';
document.getElementsByClassName('android')[0].innerHTML = '<img src="english-android.svg"/>';
} else if(language === 'nb-no'){
document.getElementsByClassName('apple')[0].innerHTML = '<img src="norwegian-apple.svg"/>';
document.getElementsByClassName('android')[0].innerHTML = '<img src="norwegian-android.svg"/>';
}
</script>
This works a treat, but when I try to add another class to document.getElementsByClassName
, it doesn't work.
Something like this:
document.getElementsByClassName('apple bottomapple')[0].innerHTML = '<img src="english-apple.svg"/>';
In the other class I'm trying to add, there's an image with the same naming e.g. english-apple.svg. I need both classes to run at the same time if(language === 'nb-no')
is true
.
Any help will be much appreciated.
Thanks