JavaScript JavaScript and the DOM Making Changes to the DOM Modifying Elements

Alexandru Pescaru
Alexandru Pescaru
5,223 Points

need some help guys

some help

app.js
var inputValue = document.getElementById('linkName').value;

var inputValue = document.documentElement('link');
index.html
<!DOCTYPE html>
<html>
    <head>
        <title>DOM Manipulation</title>
    </head>
    <link rel="stylesheet" href="style.css" />
    <body>
        <div id="content">
            <label>Link Name:</label>
            <input type="text" id="linkName">
            <a id="link" href="https://teamtreehouse.com"></a>
        </div>
        <script src="app.js"></script>
    </body>
</html>

1 Answer

Daniel Jong
Daniel Jong
9,915 Points

Just grab the text content from the a element and assign inputValue to it

document.getElementById("link").textContent = inputValue;