I'm missing something very basic I know, but I can't seem to find the solution.
I’m having difficulty understanding how html and Javascript elements interact. My code has some of the right content, but I know it's nowhere near correct yet. I'm also not sure if it matters to place the javascript code in the html file itself or if I can keep it in an external js file and call it.
Anyways, I’m trying to create a To Do list. I want to: -Store the items in my ‘list’ array -Display the entirety of the items in an ordered list -Allow a user to add new items to the list (via text input on the index page)
Any guidance would be appreciated
My code:
<body>
<div id="wrapper">
<h3></h3>
<ol id="unfinished">
<form name="addToList">
<li><input type="text" id="newItem"></li>
</form>
<li></li>
(And in my js file)
var list = []
var newItem = document.getElementsById("newItem");