Start a new topic

Using Javascript to display different language acceptance templates

Is anyone here able to offer some javascript assistance?


I need to be able to show different variations of the Acceptance template to cater for customers whose first language is not English.


I figure this may be possible by using javascript to query the language set on the browser being used to view the page and to show/hide a particular div within the page based on this.


Looking at code snippets online, I think this is a good place to start but I've not been able to get it to work as yet:

<script type="text/javascript">
var userLang = navigator.language || navigator.userLanguage;
if (userLang == "de") {
     $("#deutsch").show();
} else {
     $("#english").show();
}
</script>

Any help appreciated!

Login or Signup to post a comment