title: Restrict special characters using jQuery
body: <p>How can i restrict special characters in text field?
  the special character are assigned in one variable</p>
  
  <pre><code>sample="`!@#$%^&amp;*()"
  </code></pre>
  
  <p>This sample variable value should be checked with the first name and last name </p>
  
  <p>HTML Code</p>
  
  <pre><code>&lt;input type="text" name="Firstname" value="Firstname" id="firstname"&gt;
  </code></pre>
  
  <p>jQuery</p>
  
  <pre><code>            if(!sample.test($("#firstname").val())){
                  alert("Nickname can have only alphabets and numbers.");
              }
  </code></pre>