Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

html call javascript variable

<!DOCTYPE html>
<html>
    <body>
        <!--|/id here-->
        <p id="myText"></p>
        <p id="myTextTag"></p>
        <script>
            <!--Here we retrieve the text and show what we want to write...
            var text = document.getElementById("myText");
            var tag = document.getElementById("myTextTag");
            var toWrite = "Hello"
            var toWriteTag = "<a href='https://stackoverflow.com'>Stack Overflow</a>"
            <!--...and here we are actually affecting the text.-->
            text.innerHTML = toWrite
            tag.innerHTML = toWriteTag
        </script>
    <body>
<html>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #html #call #javascript #variable
ADD COMMENT
Topic
Name
9+1 =