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

Gandi Gandalf
Gandi Gandalf
363 Points

Code doesn't work. I don't know what to do :(

It shouldn't be a hard task, but I don't know how to do it...

var inputValue = document.querySelector('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,946 Points


  1. If you use querySelector you need to specify the type of a selector in parenthesis. For id in this case you need to add a hash sign.

  2. You are looking for an input value. So you need to append .value at the end

var inputValue = document.querySelector('#linkName').value;