Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

ReferenceError: docment is not defined at HTMLButtonElement.

I'm trying to a simple to do app and I keep getting : ReferenceError: docment is not defined at HTMLButtonElement I've looked on stackOverFlow and Google tried a couple things still not working..

HERE IS JavaScript Code

const addItemInput = document.querySelector('input.addItemInput');
const addItemBtn = document.querySelector('button.addItemBtn');
const listContainer = document.querySelector('todo-container');


addItemBtn.addEventListener('click', ()=>{
const ul = docment.getElementsByTagName('ul')[0];    
let li = document.createElement('li')
li.textContent = addItemInput.value;  
ul.appendChild(li);
});

HTML will comment in.

HTML code:

<body>
    <div class="container">
        <h1 class="name">Simply To Do</h1>
        <div class="todo-container">
            <input type="text" class="addItemInput" placeholder="Enter Task Here! ;)">
                <button class="addItemBtn">Add Task</button>
                    <button class="removeItemBtn">Remove Task</button> 
                    <ul>
                        <li>Task 1</li>
                        <li>Task 2</li>
                        <li>Task 3</li>
                    </ul>   
                </div>
            </div>    
</body>

2 Answers

Dmitry Polyakov
Dmitry Polyakov
4,989 Points

Instead of docment should be document.

I need to get my eyes check 😂 I read right over it 10x’s didn’t even notice it

Thank you!

Maybe to if I paid attention to the reference error where it said docment lol