html call variable javascript

Solutions on MaxInterview for html call variable javascript by the best coders in the world

showing results for - "html call variable javascript"
Alberto
06 Feb 2017
1<!DOCTYPE html>
2<html>
3    <body>
4        <!--\|/id here-->
5        <p id="myText"></p>
6        <p id="myTextTag"></p>
7        <script>
8            <!--Here we retrieve the text and show what we want to write...
9            var text = document.getElementById("myText");
10            var tag = document.getElementById("myTextTag");
11            var toWrite = "Hello"
12            var toWriteTag = "<a href='https://stackoverflow.com'>Stack Overflow</a>"
13            <!--...and here we are actually affecting the text.-->
14            text.innerHTML = toWrite
15            tag.innerHTML = toWriteTag
16        </script>
17    <body>
18<html>