From 7ff28f91ed43b83d7a047c4a9761c8127d91bde9 Mon Sep 17 00:00:00 2001 From: terratamo Date: Sun, 15 Sep 2019 13:09:53 -0400 Subject: [PATCH] hw8 --- index.html | 3 ++- script/script.js | 24 ++++++++++++++++++++++++ style.css => style/style.css | 0 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 script/script.js rename style.css => style/style.css (100%) diff --git a/index.html b/index.html index 4793879..724d7ca 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,8 @@ My First Chatbot - + + diff --git a/script/script.js b/script/script.js new file mode 100644 index 0000000..bb8fad1 --- /dev/null +++ b/script/script.js @@ -0,0 +1,24 @@ +// Declare input and output +const ioChatbot = { + input : "hello", + output : "hi" +}; +console.log(ioChatbot); + +// Reply function for getting input element +function reply(){ + const question = document.querySelector("#input"); + if(question.value === "hello"){ + document.querySelector("#output").textContent = "hi"; + } else{ + document.querySelector("#output").textContent = "I don't understand that command. Please enter another."; + } + + console.log(question.value); +} + +if(document.querySelector("#submit")){ +document.querySelector("#submit").addEventListener("click", function(){ + reply(); +}); +} \ No newline at end of file diff --git a/style.css b/style/style.css similarity index 100% rename from style.css rename to style/style.css