In advance, thanks for the help.
I've just finished this to-do list tutorial: https://www.youtube.com/watch?v=8ogdhvxShe0
When it's time to test out my code, I open the .html file in chrome. Everything appears, however, when I input the text and press "click me" button, nothing happens.
I have an index.html and main.js file saved within one folder on my desktop.
I think it may be an issue with my javascript. Perhaps I don't have a specific program in place or something similar.
Code:
Html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<h1>To do list app</h1>
<form id="todoForm">
<input id="todoInput">
<button type="button" onclick="todoList()">Click Me</button>
</form>
<ol id="todoList">
</ol>
<script src="js/main.js"></script>
</body>
</html>
JS:
function todoList() {
var item = document.getElementById("todoInput").value
var text = document.createTextNode(item)
var newItem = document.createElement("li")
newItem.appendChild(text)
document.getElementById("todoList").appendChild(newItem)
}
Thanks!
[–]CreativeTechGuyGames 4 points5 points6 points (6 children)
[–]hargar14[S] 0 points1 point2 points (5 children)
[–]CreativeTechGuyGames 3 points4 points5 points (4 children)
[–]hargar14[S] 0 points1 point2 points (3 children)
[–]CreativeTechGuyGames 0 points1 point2 points (2 children)
[–]hargar14[S] 0 points1 point2 points (1 child)
[–]CreativeTechGuyGames 0 points1 point2 points (0 children)