USE THE GIVEN STARTER HTML& JS FILES (DON’T NEED CSS FILE):
Using a state machine design pattern and keypress() create a website that can capture user keyboard input. Each time the user types in something and hits <enter> a new TODO list item will be added to the panel. Using click() add a reset button that clears the list. $(document).ready(function() { $(“li”).css(“id”, “uw”); const states = [“idle”, “gather”, “process”]; var state = states[0]; var words = new Array ( ; var ndx = 0; $(“ul”).on(“mouseover”, “li”, function() { console.log(“x:” + $(this).text()); $(this).attr(“id”, “u”); }); $(“ul”).on(“mouse leave”, “li”, function() { $(this).attr(“id”, “uw-gold”); }); // reset button click $(“button”).on(“click”, function(e) {}); // keypress $(“input”).on(“keypress”, function(e) { var code = e. which; // var char = String.fromCharCode(code); // console.log(‘key: ‘ + code + ‘tstate:’ + state); switch (state) { // idle case “idle” : break; // gather case “gather”: break; // process case “process”: break; default: break; }); }); We were unable to transcribe this imageShow transcribed image text Using a state machine design pattern and keypress() create a website that can capture user keyboard input. Each time the user types in something and hits a new TODO list item will be added to the panel. Using click() add a reset button that clears the list.
$(document).ready(function() { $(“li”).css(“id”, “uw”); const states = [“idle”, “gather”, “process”]; var state = states[0]; var words = new Array ( ; var ndx = 0; $(“ul”).on(“mouseover”, “li”, function() { console.log(“x:” + $(this).text()); $(this).attr(“id”, “u”); }); $(“ul”).on(“mouse leave”, “li”, function() { $(this).attr(“id”, “uw-gold”); }); // reset button click $(“button”).on(“click”, function(e) {}); // keypress $(“input”).on(“keypress”, function(e) { var code = e. which; // var char = String.fromCharCode(code); // console.log(‘key: ‘ + code + ‘tstate:’ + state); switch (state) { // idle case “idle” : break; // gather case “gather”: break; // process case “process”: break; default: break; }); });
Expert Answer
Answer to Using a state machine design pattern and keypress() create a website that can capture user keyboard input. Each time the…