The suggestions will also change color as the user hovers over them and will change the input if clicked
This is a default option and will only suggest things previously typed in the input, so not really helpful for us
Add this code to index.html:
Hint: If you need help with these two blanks, then look at the first and last line of code inside the checkInput() function
Make sure that v is also set to all lower case!
Update this code inside the suggestion function:
This will help us in the next step when we are comparing the input to all words
We can use it by slicing a word's first amount of letters as explained in the example below:
The hidden code is checking if the input is equal to a slice of the word.
That slice starts at the first letter and needs to be as long as the input's length.
The suggestions should now appear below as we type an input
Add this to the bottom of index.js:
So including the word variable, we will need to add seven strings together to accomplish the complete string
Here's an example of how it will cause an error:
To add a quoation mark to a string without closing the string, add a forward slash / before the quotation mark, like so:
We should now be able to click on a suggestion that will make the input change to it
We will be using the CSS code to easily accomplish this
Add this to index.css:
Created 6 months ago
Teach coding to your students with MVCode Teach
MVCode offers an integrated product designed to teach coding to students.
Learn more about MVCode Teach