JavaScript for Focusing and Selecting a Form Element

This script initially simply puts the cursor into the email form element, so that the visitor may begin typing upon first entry to page.

However, if you type an email address with any basic mistakes, it triggers an alert and then both focuses on mistaken entry and highlights it.

Email:

 
  
 
Copy-N-Paste Window

Simply copy (type Control-c or Apple-c) the script from the window below. Then paste it (type Control-v or Apple-v) into your text editor and save (Control-s or Apple-s).