Checking for keyup event in Javascript
<p>I am trying to use the <a href="http://jquerycreditcardvalidator.com/" rel="nofollow">jQuery Credit Card Validator</a> to validate credit cards.</p>

<p>The basic usage is given as </p>

<pre><code>$('#cc_number').validateCreditCard(function(result)
{
alert('CC type: ' + result.card_type.name
  + '\nLength validation: ' + result.length_valid
  + '\nLuhn validation: + result.luhn_valid');
});
</code></pre>

<p>I looked on the demo JS file included on that site and couldn't make head nor tail.</p>

<p>What I am trying to achieve is onkeyup of input, do something depending on what card type is caught:</p>

<pre><code> //on key up of input
 if (card == valid) 
   {
     if (card == visa)
      {
        //do something
      }
     else if (card == mastercard)
     {
        //do something
     }
       // repeat for rest of card types
   }
 else
   {
     //Just print an error
   }
</code></pre>

<p>I know it's fairly basic stuff, but can anybody help me with how to achieve?</p>

<pre><code> my HTML:
 &lt;input type="text" id="cc_number" /&gt;
</code></pre>
