Skip to main content

Exercise 45

  • Create the following folder/file structure:
/ex_45
|-- index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Form Properties</title>
</head>
<body>
<form
action="save_user.html"
method="post"
enctype="application/x-www-form-urlencoded"
name="login"
>
<input type="text" id="username" name="username" />
<input type="password" id="pass" name="pass" />
<input type="submit" name="submit" value="Send" />
</form>
<div></div>
</body>
</html>

index.html

  • Create a basic HTML document
  • Create a script tag on the document head element
  • Select the form element using any of the JavaScript selectors
  • Show the inputs values (same as previous exercise) when the user submits the form
  • You'll have to prevent the form default behaviour
  • Also, you can use the previous code as starting point
  • You need to handle the submit event and not the input type submit click event (just in case!)