ソースを参照

added getemptymask command to retrieve the default (empty) mask value
this can be usefull to set the defaultvalue in jquery.validate or other validation mechanisms

Robin Herbots 14 年 前
コミット
cc534d9865
2 ファイル変更15 行追加1 行削除
  1. 10 0
      README
  2. 5 1
      jquery.inputmask.js

+ 10 - 0
README

@@ -200,3 +200,13 @@ casing can be null, "upper" or "lower"
 $(document).ready(function(){
    $("#test").inputmask("999-AAA");       => 123abc ===> 123-ABC 
 });
+
+getemptymask command
+
+return the default (empty) mask value
+
+$(document).ready(function(){
+   $("#test").inputmask("999-AAA");    
+   alert($("#test").inputmask("getemptymask"));   => "___-___" 
+});
+

+ 5 - 1
jquery.inputmask.js

@@ -3,7 +3,7 @@ Input Mask plugin for jquery
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 0.4.6b - dev
+Version: 0.4.6c - dev
  
 This plugin is based on the masked input plugin written by Josh Bush (digitalbush.com)
 */
@@ -123,6 +123,10 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
                             }
                         });
                         break;
+                    case "getemptymask":
+                        if(this.data('inputmask'))
+                    		return this.data('inputmask')['_buffer'].join('');
+                    	else return "";
                     default:
                         //check if the fn is an alias
                         if (!ResolveAlias(fn)) {