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

Why do none of the methods work? Is there a bug in the challenge?

var inputValue = document.getElementById('linkName'); //this should work. Tried querySelector as well and that didn't work.

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

Maher Wardak
Maher Wardak
4,595 Points

Hi Leo,

You need to retrieve the value of the input. So the code should look like this:

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

Thanks Maher! That works.