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

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

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

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;