Skip to content
Justice Tech School

Simple Form Validation

Check values and show errors.

Example
$("form").on("submit", function (e) {
  var email = $("#email").val().trim();
  if (!email) {
    e.preventDefault();
    $("#err").text("Email required").show();
  }
});

Exercise

Trim.

$("#e").val().()

Quiz Test

What does trim remove?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.