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

Riley Egan
Riley Egan
7,254 Points

I'm unable to pass the second challenge of "Modifying Elements" in JavaScript and the DOM.

I've rewatched the videos multiple times and can't figure out how to pass the second test. I keep getting the error that test 1 fails whenever I try to pass test 2.

I've tried multiple ways of setting the value in set 1 and would love some help on how to do this in a way that passes both tests.

Thanks!

app.js
const input = document.querySelector('input');

let inputValue = input.value;

a.innerHTML = input.value;



//button.addEventListener('click', function() {
//  a.textContent = inputValue;
//})
index.html
<!DOCTYPE html>
<html>
    <head>
        <title>DOM Manipulation</title>
    </head>
    <link rel="stylesheet" href="style.css" />
    <body>
        <div id="content">
            <label>Link Name:</label>
            <input type="text" id="linkName">
            <a id="link" href="https://teamtreehouse.com">'inputValue'</a>
        </div>
        <script src="app.js"></script>
    </body>
</html>

2 Answers

Neil McPartlin
Neil McPartlin
12,018 Points

Riley. You are nearly there.

1: In your first line, replace querty with query.

2: Although using inputVal in lines 1 & 3 would work in the wild, these challenges expect back the word they specified, so replace both with inputValue

Riley Egan
Riley Egan
7,254 Points

let inputVal = document.quertySelector('input').value;

const a = document.querySelector('a');

a.textContent = inputVal;