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

This question is really difficult for me to understand for some reason. Would love any explanation or hints.

Not sure how to use the id '#idName' and input.value in a querySelector statement together.

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

Front End Web Development Techdegree Student 15,247 Points

Hey Jonathan Ambriz,

You were very close on the first part of the challenge, you simply need to store a value inside inputValue variable and you can do this by using a value property after selecting input element with the id of linkName. The value property sets or returns the value of the value attribute of a text field.

Here's the final version:

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

To understand how value property works, check out this website:

Hope this helps!