How to insert variable into HTML
dom, html, javascript
Solution
One way is to use `document.write`:
<li><a class="active" href="#"><script>document.write(Karting.translationsLV['Home'])</script></a></li>
Problem
I'm having a little problem, i have a translations JSON variable. And i want to put it on HTML. Is there a way to make it somehow? My JS file: ``` var Karting = Karting || {}; Karting = { lang : 'lv', translationsLV: { "Home" : "Ziņas", }, } ``` And i want to do this: My page is static and i'm not using any templating engines. ``` <li><a class="active" href="#">Karting.translationsLV['Home']</a></li> ``` EDIT: Added this: ``` $(window).load( function() { var translations; if (Karting.lang=='lv') { translations = Karting.translationsLV; } else { translations = Karting.translationsENG; } }, false ); ``` This doesn't show my element ``` document.write(translations['Home']) ``` UncaughtRefferenceError - translations is not defined