Goal: Practice using jQuery elements with HTML forms:
submit()
functionlet
or const
(or var
) to declare a variable? Why is that bad?bunnyName
, one when the function runs and one at the end of the code. What value do you expect at each alert? (Use JSFiddle to test your theories.)let bunnyName = "Flopsy";
function hippityHoppity() {
alert(bunnyName);
bunnyName="Cottontail";
}
hippityHoppity();
alert(bunnyName);
What values do you expect at these alerts?
let bunnyName = "Flopsy";
function hippityHoppity() {
let bunnyName = "Mopsy";
alert(bunnyName);
bunnyName="Cottontail";
}
hippityHoppity();
alert(bunnyName);
event.preventDefault()
when working with jQuery forms?First, take the time to follow along with the lesson to make a Mad Libs website of your own.Then, meet the goal by completing one of the projects below.
Make a form letter where the user inputs their name, and they get back a letter addressed to them. Feel free to use lorum ipsum for the text of the letter. Use Bootstrap and your knowledge of CSS to make the letter look like a letter or virtual postcard.
Create a page that asks the user to type something into a field, and when they submit the form, have the page say it back to them in all uppercase.
Lesson 46 of 65
Last updated May 23, 2022