title: how to restrict special characters and ( /,*,+) only
body: <p>We have one text Field.We know how to restrict special  characters.But We need Allow  alphabet  and Numbers and hyphen(-) only.No need Sepcial characters but except (-) . Give me any idea.</p>
  
  <p>Mycode:</p>
  
  <pre><code>$('#pduration').keydown(function (e) {
             if (e.shiftKey || e.ctrlKey || e.altKey) {
                  e.preventDefault();
              } else {
                 var key = e.keyCode;
                 if (keyCodeEntered == 45) {
                     // Allow only 1 minus sign ('-')...
                    if ((elementRef.value) &amp;&amp; (elementRef.value.indexOf('-') &gt;= 0))
                         return false;
                     else
                         return true;
                 }
  
             }
         });
  </code></pre>
  
  <p>If we tried this code it's restrict spectal charecters but it's allow -,/,+ Please guide me only allow number and alphabet and hyphen only</p>