From 26c125afc5fd0ce33281ae795c84a55e98bbb7bf Mon Sep 17 00:00:00 2001 From: moepoi Date: Wed, 10 Nov 2021 12:00:54 +0700 Subject: [PATCH] Add bag.js --- public/js/bag.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 public/js/bag.js diff --git a/public/js/bag.js b/public/js/bag.js new file mode 100644 index 0000000..e5e21b6 --- /dev/null +++ b/public/js/bag.js @@ -0,0 +1,19 @@ +function add(id) { + var inputCount = document.getElementById(id); + console.log("I got clicked"); + if (inputCount.value < 9) { + inputCount.value++; + } else { + alert("MAX product reach"); + } +} + +function minus(id) { + var inputCount = document.getElementById(id); + console.log("Minus got clicked"); + if (inputCount.value > 1) { + inputCount.value--; + } else { + alert("Remove this item"); + } +} \ No newline at end of file