Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
angelabauer authored Mar 11, 2024
1 parent 2be83b0 commit 9776446
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ var inputValues = [];
var bandName = "";
const inputPrompts = ["What's your pet's name?"];
let isFirstClick = true;
let isOn = true;

//Click Run
$(document).ready(function () {
$("#run-button").click(function () {
isOn = true;
inputValues = [];
var bandName = "";
$("#Content").empty();
Expand All @@ -19,14 +21,12 @@ $(document).ready(function () {

//Enter button
$(document).on("keydown", function (e) {
var x = e.which || e.keyCode;
if (x === 13 || x == 13) {
var x = event.which || event.keyCode;
if (x == 13 && isOn) {
var consoleLine = $("#" + CurrentId + " input").val();

console.log(`consoleLine: ${consoleLine}`);
console.log(`bandName: ${bandName}`);
bandName += " " + consoleLine;
// if (bandName != "") bandName += " " + consoleLine;
console.log(consoleLine);
bandName += ` ${consoleLine}`;
inputValues.push({ id: CurrentId, val: consoleLine });

console.log(inputValues);
Expand All @@ -36,6 +36,7 @@ $(document).on("keydown", function (e) {
NewLine("Your band name could be " + bandName, false);

$(".console-carrot").remove();
isOn = false;
return;
}

Expand All @@ -46,7 +47,7 @@ $(document).on("keydown", function (e) {
}
});
$(document).on("keydown", function (e) {
var x = e.which || e.keyCode;
var x = event.which || event.keyCode;
var line = $("#" + CurrentId + " input");
var length = line.val().length;
if (x != 8) {
Expand Down

0 comments on commit 9776446

Please sign in to comment.