diff --git a/Challenges/Week2/app.js b/Challenges/Week2/app.js index 146acc5..1aa2f9c 100644 --- a/Challenges/Week2/app.js +++ b/Challenges/Week2/app.js @@ -3,6 +3,29 @@ //Prompt user for input and store variable +function processInput(message) +{ + + console.log(message); + + if(message == 'Hello!') + { + return('Hello world!'); + + } else { + return("You didn't say hello :("); + } +} + +var userInput; + +userInput = prompt(); + +var response = processInput(userInput); + +console.log(response); + + //Call function //Alert user results diff --git a/Challenges/Week2/index.html b/Challenges/Week2/index.html index afe8e37..ff72f2d 100644 --- a/Challenges/Week2/index.html +++ b/Challenges/Week2/index.html @@ -15,6 +15,7 @@

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..c582601 100644 --- a/Challenges/Week3/index.html +++ b/Challenges/Week3/index.html @@ -42,8 +42,8 @@

    Flash Cards

    - - + + - \ No newline at end of file + diff --git a/Challenges/Week3/js/app.js b/Challenges/Week3/js/app.js index 432dc9b..56765d7 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. +// 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. +/* 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 + Bonus: Change the text of the button using jQuery when you toggle the answers on/off. */ +$()