diff --git a/scripts.js b/scripts.js index 922ffcb..d56e8de 100644 --- a/scripts.js +++ b/scripts.js @@ -4,7 +4,7 @@ submit.addEventListener("click", validateForm) treeHeight.addEventListener("keydown", returnCheck) treeChar.addEventListener("keydown", returnCheck) -// Assigning input values to an object after event validation and passing to the buildTree function +// Assigning input values to an object after event validation function treeCapture() { var tree = { @@ -26,8 +26,8 @@ function validateForm() { // Function to check whether the enter key was pressed -function returnCheck() { - if (event.keyCode === 13) { +function returnCheck(e) { + if (e.keyCode === 13) { validateForm(); } }