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

Selecting element by id

I don't understand what I'm doing wrong in this exercise. I've done exactly what the video mentioned in the instructions

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

Dmitry Polyakov
Dmitry Polyakov
4,945 Points

You should grab the value of the element that you are selecting You were very close

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

I swear I tried that but thank you!!