Here we have a form that has valid HTML5 syntax. We have
used email, url and number
inputs as well as a normal text input with
a pattern attribute. The requred attribute
is used to indicate a mandatory field. The old school but
handy maxlength attribute makes it impossible to enter
more than 30 characters.
This is the simple part. Simply initialize validator and you'll get
all the HTML5 niceties.
You need to place the script block after the
HTML code or you can alternatively use
jQuery's $(document).ready to execute the script as
soon as the webpage's Document Object Model (DOM) has been
loaded. Read more about that from
the User's
Manual.
CSS coding
We have used one external
stylesheet for
the design. It has styling for the whole form. Here we focus on the
validation and the error message: