Created
April 4, 2017 09:15
-
-
Save vigzmv/d7cc2cb6834642b7bdfd01a145c61f1e to your computer and use it in GitHub Desktop.
jas16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>TODO LIST</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> | |
</head> | |
<body> | |
<h1>TO-DO LIST</h1> | |
<div class="inputbar"> | |
<input type="text" id="userinput" autofocus placeholder="enter here..."> | |
<input type="submit" value="save" onclick="displayOutput()"> | |
</div> | |
<h2>YOUR TASKS</h2> | |
<div class="list"> | |
</div> | |
<script type="text/javascript"> | |
function cross(self) { | |
if ($(self)[0].checked) { | |
$(self).next()[0].innerHTML = '<s>' + $(self).next()[0].innerHTML + '</s>'; | |
} else { | |
$(self).next()[0].innerHTML = $(self).next()[0].innerHTML.slice(3); | |
} | |
} | |
function del(self) { | |
$(self).parent().remove(); | |
} | |
function displayOutput() { | |
let input1 = document.getElementById("userinput"); | |
const checkbox = ` | |
<div> | |
<input type="checkbox" id="issd" onClick="cross(this)"> | |
<span> ${input1.value} </span> | |
<button type='button' class='remove-me' onClick=del(this)> x </button> | |
<br/> | |
</div>`; | |
$('.list').append(checkbox); | |
input1.value = ''; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment