Skip to content

Latest commit

 

History

History
35 lines (31 loc) · 965 Bytes

ex_45.md

File metadata and controls

35 lines (31 loc) · 965 Bytes

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!)