I’m new to this forum and very new to web development. I just picked up a first project for practice.
I faced a problem. the Error is : **Uncaught TypeError: Document.getElementById is not a function
at HTMLButtonElement.<anonymous>
**my js code is :**
document.getElementById(‘add’).addEventListener(‘click’, function() {
let value = Document.getElementById(‘item’).value;
if (value) addItemTodo(value); });
function addItemTodo(text) {
let list = document.getElementById(‘todo’);
let item = document.createElement(‘li’);
item.innerText = text;
let buttuns = document.createElement(‘div’);
buttuns.classList.add(‘buttuns’);
**and my HTML code is:
<body>
<header>
<input type=”text” placeholder=”Enter your favorite food …” id=”item”>
<button id=”add”>
<svg height=”30.33333pt” viewBox=”0 0 400.33333 550.33333″ width=”30.33333pt” xmlns=”
<g >
<path class=’fill’
d=”m437.332031 192h-405.332031c-17.664062 0-32 14.335938-32 32v21.332031c0 17.664063 14.335938 32 32 32h405.332031c17.664063 0 32-14.335937 32-32v-21.332031c0-17.664062-14.335937-32-32-32zm0 0″/><path d=”m192 32v405.332031c0 17.664063 14.335938 32 32 32h21.332031c17.664063 0 32-14.335937 32-32v-405.332031c0-17.664062-14.335937-32-32-32h-21.332031c-17.664062 0-32 14.335938-32 32zm0 0″/></g>
</svg>
</button>
</header>
<div class=”container”>
<!–uncompleted task–>
<ul class=” todo ” id=”todo”>