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

Neil Martin Orbase
Neil Martin Orbase
2,914 Points

Assistance please! Not sure if I'm understand how to select text input correctly...

I've been stuck on this problem for almost 30 mins... rewatched the video that was suggested, followed the suggestion... and still, nothing... I even tried this: var inputValue = document.querySelector('linkName');

And that still fails =(

var inputValue = document.getElementById('linkName');
<!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

Hi, you have to use .value to get the value from the text input

The code would look like this:

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

Hope this helps!