From ddcf38c1451e00872958215a3a81ba7c29061bc7 Mon Sep 17 00:00:00 2001 From: litlgub <51003344+litlgub@users.noreply.github.com> Date: Sat, 15 Jun 2019 16:58:25 -0400 Subject: [PATCH] Added Jscript file. --- index.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 index.js diff --git a/index.js b/index.js new file mode 100644 index 00000000..a3447b41 --- /dev/null +++ b/index.js @@ -0,0 +1,31 @@ +$(function() { + + /*check button*/ + $('.shopping-list').on('click', '.shopping-item-toggle', function(event) { + $(this).closest('li').find('.shopping-item').toggleClass('shopping-item__checked'); + }); + + /*delete button*/ + $('.shopping-list').on('click', '.shopping-item-delete', function(event) { + $(this).closest('li').remove(); + }); + + /*add item*/ + $('#js-shopping-list-form').on('submit', function(e) { + e.preventDefault(); + let text = $('input:text').val(); + console.log("text = " + text); + $('ul.shopping-list').append(`