2
The code
<section class="content">
<span></span>
<span></span>
<script type="text/javascript" src="../js/purl.js"></script>
<script>
var vars = geturlvar()['Nome'];//traz embalagem.html se colocar um alert!
</script>
<img src="../images/aguarde.gif" id="image">
<div id="url" w3-include-html=vars></div>
</section>
I need to take the value that is in vars (which is packing.html) and put inside the
<div id="url" w3-include-html=vars></div>
how do I do that?
use: Document.getElementById("url"). innerHTML = vars;
– alan
I put this code under var vars = geturlvar()['Name'] inside the <script> tag, but the following error appears when debugging: Uncaught Typeerror: Cannot set Property 'innerHTML' of null, but if I put an Alert or in the console I get the value of the vars variable ok.
– Gleyson Silva
You’re wearing it before the div is created. Place your javascript code after creating the div id="url" or create a function scope in javascript q waits for page loading to load the javascript later
– alan
but if I create javascript after div it error in vars variable that was not set, you could make an example, sorry I’m new in javascript
– Gleyson Silva
Below are two examples that solve your problem. One given by @Artur and the other by me!
– alan