diff --git a/Challenges/Week2/app.js b/Challenges/Week2/app.js index 146acc5..c4da6fb 100644 --- a/Challenges/Week2/app.js +++ b/Challenges/Week2/app.js @@ -1,8 +1,19 @@ -//create function - //control and return statements -//Prompt user for input and store variable +function processInput(message) +{ + if(message === "hello") + { + return ("Hello World!"); + } + else { + return("You didn't say hello :("); + } +} -//Call function +var userInput; -//Alert user results +userInput = prompt(); + +var response = processInput(userInput); + +console.log(response); \ No newline at end of file diff --git a/Challenges/Week2/index.html b/Challenges/Week2/index.html index afe8e37..2f1bae7 100644 --- a/Challenges/Week2/index.html +++ b/Challenges/Week2/index.html @@ -15,6 +15,6 @@

My first code challenge!

  • Don't forget to call your script file from this HTML file! I've created the script tags for you, but you have to add something to it! - + diff --git a/Challenges/Week3/index.html b/Challenges/Week3/index.html index 2ee5d5a..ab0ba52 100644 --- a/Challenges/Week3/index.html +++ b/Challenges/Week3/index.html @@ -42,8 +42,7 @@

    Flash Cards

    - - + \ No newline at end of file diff --git a/Challenges/Week3/js/app.js b/Challenges/Week3/js/app.js index 432dc9b..53698c2 100644 --- a/Challenges/Week3/js/app.js +++ b/Challenges/Week3/js/app.js @@ -1,14 +1,19 @@ // 1.) Make sure you have a reference to jQuery from a CDN in the index.html file. // 2.) Use a jQuery to hide all of the answers to all the questions. -$('.answer') +$('.answer').hide(); /* 3.) Write code to show the answer when hovering over a flash card, and hide it when the mouse leaves. Find the approriate event on the jQuery API page to trigger an action on hover https://api.jquery.com/category/events/ Hint: You can use "this" inside your jQuery function to reference a selected DOM node. */ -$('.flash-card') - +$('.flash-card').hover(function () { + $(this).find('.answer').show(); +}, function () { + $(this).find('.answer').hide(); +}); /* 4.) Use jQuery to find the button element on the page and have it toggle all of the answers on and off when clicked. Hint: jQuery has a toggle function that can toggle the visibility of a selected DOM node. Bonus: Change the text of the button using jQuery when you toggle the answers on/off. */ -$() \ No newline at end of file +$('.cheat-button').click(function () { + $('.answer').toggle(); +}) \ No newline at end of file diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..95d09f2 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +hello world \ No newline at end of file