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

Riley Egan
Riley Egan
7,255 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.


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

let inputValue = input.value;

a.innerHTML = input.value;

//button.addEventListener('click', function() {
//  a.textContent = inputValue;
<!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="">'inputValue'</a>
        <script src="app.js"></script>

2 Answers

Neil McPartlin
Neil McPartlin
14,627 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,255 Points

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

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

a.textContent = inputVal;