Insert '-' every 5 characters as users type [like a product key]
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/109854/auto-format-structured-data-phone-date-using-jquery-plugin-or-failing-that-v">Auto-format structured data (phone, date) using jQuery plugin (or failing that vanilla JavaScript)</a><br>
  <a href="http://stackoverflow.com/questions/6579584/insert-space-after-certain-character-into-javascript-string">Insert space after certain character into javascript string</a>  </p>
</blockquote>



<p>I am trying to write a script that handles product keys like the ones you see on the back of software and games.</p>

<p>I would like so when the user is inputing their key code the '-' are inserted every 5 characters for 5 sets of characters. Ex(<code>ABCDE-FGHIJ-KLMNO-PQRST-UVWXY</code>). So when the user enters <code>ABCDE</code> as soon as the '<code>E</code>' is enetered a '<code>-</code>' is inserted immeditly after via jQuery or JavaScript.</p>

<p>Thanks In Advance.
Comment if you have any questions or if I was unclear :)</p>

<p>Form:</p>

<pre><code>&lt;form method="post" action="process.php"&gt;
&lt;p&gt;Key: &lt;input name="key" id="key" size="40"&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type="submit"&gt;&lt;/p&gt;
&lt;/form&gt;
</code></pre>
