Created
August 16, 2020 12:43
-
-
Save amitkrishna/2ad0270728271eda516112ffde49d28b to your computer and use it in GitHub Desktop.
Onemonth JS for Todo List
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
$(document).ready(function () { | |
// YOUR CODE HERE! | |
$(".add-items").submit(function ( $event ){ | |
$event.preventDefault(); | |
var item = $("#todo-list-item").val(); | |
console.log($("#todo-list-item").val()); | |
console.log(typeof(item)); | |
console.log(typeof(item.val));// undefined | |
if (Boolean(item.val)) {// run only if condition is true | |
console.log(Boolean(item.val));// gets the value of the item | |
console.log(typeof(item)); | |
console.log("Hit"); | |
$("#list-items").append("<li><input type='checkbox'/>" + item + "<a class='remove'>x</a></li>"); | |
$("#todo-list-item").val(""); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment