AlphaNumeric

フォーム入力の文字種を半角英数字などに限定する

Examples

  1. \w(半角英数)
  2. \w + dot comma space
  3. [a-z]
  4. [0-9]
  5. [0-9] dot(.)
  6. custom rule
<script type="text/javascript">
$(function(){ 
  $('.ex1').alphanumeric();
  $('.ex2').alphanumeric({allow:"., "});
  $('.ex3').alpha({nocaps:true});
  $('.ex4').numeric();
  $('.ex5').numeric({allow:"."});
  $('.ex6').alphanumeric({ichars:'.1a'});
});
</script>
  
<ol>
 <li><input type="text" class="ex1 tb" size="10" /> \w(半角英数)</li>
 <li><input type="text" class="ex2 tb" size="10" /> \w + dot comma space</li>
 <li><input type="text" class="ex3 tb" size="10" /> [a-z] </li>
 <li><input type="text" class="ex4 tb" size= "10" /> [0-9] </li>
 <li><input type="text" class="ex5 tb" size="10" /> [0-9] dot(.)</li>
 <li><input type="text" class="ex6 tb" size="10" /> custom rule </li>
</ol>
  

API Functions

  1. alphanumeric - allow both alphabet and numeric characters
  2. alpha - allow only alphabet characters
  3. numeric - allow only numeric characters

API Properties

  1. allow - add excempted characters to the rule of prevention
  2. ichars - define a custome set of characters to prevent
  3. allcaps - allow only capital letters to be entered
  4. nocaps - allow only lowercase characters to be entered