Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

todo app html css javascript

/*https://gist.githubusercontent.com/victorkane/fd1a062813692ce13c9e1ec6ee8bc2e6/raw/1e97cf5d8867ce397e25e1859930032db5c3ae81/index.html*/
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>TODO List (tasks)</title>

<style>
.todo-done {
    text-decoration: line-through;

}
.todo-new {
    text-decoration: none;

}
</style>
</head>
<body>

<h1>TODO List (tasks)</h1>

<h2>App</h2>

<p>Add todos (tasks) to a todo list, cross them out when done</p>

<input type="text" id="myText" placeholder="Add todo">  <button onclick="myFunction()">Add task</button>

<div id = "todolist"> </div> <button onclick="removeItem()">Remove completed items</button>

<h2>Challenges for the next class</h2>

<ol>
  <li>- [ ] When I add a task, the input field is reset to empty</li>
  <li>- [ ] When I click on a task a second time, it is no longer "done" (toggle crossed out)</li>
  <li>- [ ] When I click on the button <strong>Remove done items</strong> those crossed out as done are removed from the list</li>
  <li>- [ ] Place a "done" button next to each</li>
  <li>- [ ] Make it possible to add items by just pressing the <Enter> key</li>
</ol>

<script>

function myFunction() {

    var para = document.createElement("P");
    para.setAttribute("class", "todo-new");
    para.setAttribute("onclick", "toggle(event)");
    var theText = document.getElementById("myText");
    s = theText.value;
    var textnode = document.createTextNode(s);
    para.appendChild(textnode);
    document.getElementById("todolist").appendChild(para);
}

function toggle(event) {
  if(event.target.getAttribute("class")==="todo-new"){
        event.target.setAttribute("class", "todo-done")
  }
}

function removeItem() {
}
</script>

</body>
</html>
Comment

todo app html css javascript

/*https://gist.githubusercontent.com/victorkane/fd1a062813692ce13c9e1ec6ee8bc2e6/raw/1e97cf5d8867ce397e25e1859930032db5c3ae81/index.html*/
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>TODO List (tasks)</title>

<style>
.todo-done {
    text-decoration: line-through;

}
.todo-new {
    text-decoration: none;

}
</style>
</head>
<body>

<h1>TODO List (tasks)</h1>

<h2>App</h2>

<p>Add todos (tasks) to a todo list, cross them out when done</p>

<input type="text" id="myText" placeholder="Add todo">  <button onclick="myFunction()">Add task</button>

<div id = "todolist"> </div> <button onclick="removeItem()">Remove completed items</button>

<h2>Challenges for the next class</h2>

<ol>
  <li>- [ ] When I add a task, the input field is reset to empty</li>
  <li>- [ ] When I click on a task a second time, it is no longer "done" (toggle crossed out)</li>
  <li>- [ ] When I click on the button <strong>Remove done items</strong> those crossed out as done are removed from the list</li>
  <li>- [ ] Place a "done" button next to each</li>
  <li>- [ ] Make it possible to add items by just pressing the <Enter> key</li>
</ol>

<script>

function myFunction() {

    var para = document.createElement("P");
    para.setAttribute("class", "todo-new");
    para.setAttribute("onclick", "toggle(event)");
    var theText = document.getElementById("myText");
    s = theText.value;
    var textnode = document.createTextNode(s);
    para.appendChild(textnode);
    document.getElementById("todolist").appendChild(para);
}

function toggle(event) {
  if(event.target.getAttribute("class")==="todo-new"){
        event.target.setAttribute("class", "todo-done")
  }
}

function removeItem() {
}
</script>

</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: Enqueue jquery for TypeError: $.browser is undefined issue 
Javascript :: check token balance of an address in js 
Javascript :: docker healthcheck express 
Javascript :: Backbone View Template 
Javascript :: javascript check if array has at least one true value 
Javascript :: winston transport file another directory 
Javascript :: button style when clicked and unclicked react material 
Javascript :: wait untill 2 
Javascript :: JavaScript is synchronous by default 
Javascript :: discord.js create a private channel 
Javascript :: Simple Backbone Example 
Javascript :: react private routes 
Javascript :: javascript for backend 
Javascript :: react get variable from child component 
Javascript :: get selected data items kendo grid 
Javascript :: Closure examples 
Javascript :: or js 
Javascript :: javascript promise example 
Javascript :: math.ceil node js 
Javascript :: javascript add css class 
Javascript :: react component pass props 
Javascript :: adonisjs char 
Javascript :: EFSavechanges 
Javascript :: JavaScript Rules for Naming JavaScript Variables 
Javascript :: JavaScript Access Symbol Description 
Javascript :: JavaScript pauses the async function until the promise 
Javascript :: error:0308010C:digital nextjs 
Javascript :: how to divide a month into weeks in moment js 
Javascript :: npm function-memoizer 
Javascript :: phaser random ellipse 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =