2012-07-19 28 views
0

我嘗試通過該lesson實現輸入用戶掩碼,並且無法運行它。它不起作用。JQuery - 無法實現輸入用戶掩碼

我的.html文件:

<!DOCTYPE html> 
<html> 
    <head> 
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"> 
    <title>Page Title</title> 

    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script> 
    <script src="jquery-1.3.2.min.js" type="text/javascript"></script> 
    <script type="text/javascript" charset="utf-8"> 
     jQuery(function($){ 
     $("#date").mask("99/99/9999"); 
     }); 
    </script> 

    </head> 
    <body id="" onload=""> 
    The following example is a demonstration from the usage tab. 
    <table border="0"> 
     <tbody> 
     <tr> 
      <td>Date</td> 
      <td><input id="date" tabindex="1" type="text"></td> 
      <td>99/99/9999</td> 
     </tr> 
     </tbody> 
    </table> 
    </body> 
</html> 

難道我做錯了什麼?

回答

4

你還沒有包含插件腳本文件。

<script src="<path here>jquery.maskedinput.js" type="text/javascript"></script> 
+0

你說得對。但我遇到了另一件奇怪的事情。包含這個文件後,它仍然不起作用。 – ExiRe 2012-07-19 13:08:33

+0

@ExiRe你可以詳細說明嗎?提供一個jsfiddle ... – 2012-07-19 13:11:07

+0

@ExiRe確保在jQuery腳本之後添加了插件腳本。 – 2012-07-19 13:11:31