validatepassword.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Validate Password - jQuery EasyUI Demo</title>
  6. <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
  7. <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
  8. <link rel="stylesheet" type="text/css" href="../demo.css">
  9. <script type="text/javascript" src="../../jquery.min.js"></script>
  10. <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
  11. </head>
  12. <body>
  13. <h2>Validate Password</h2>
  14. <p>This example shows how to validate whether a user enters the same password.</p>
  15. <div style="margin:20px 0;"></div>
  16. <div class="easyui-panel" style="width:400px;padding:50px 60px">
  17. <div style="margin-bottom:20px">
  18. <input class="easyui-textbox" prompt="Username" iconWidth="28" style="width:100%;height:34px;padding:10px;">
  19. </div>
  20. <div style="margin-bottom:20px">
  21. <input id="pass" class="easyui-passwordbox" prompt="Password" iconWidth="28" style="width:100%;height:34px;padding:10px">
  22. </div>
  23. <div style="margin-bottom:20px">
  24. <input class="easyui-passwordbox" prompt="Confirm your password" iconWidth="28" validType="confirmPass['#pass']" style="width:100%;height:34px;padding:10px">
  25. </div>
  26. </div>
  27. <script type="text/javascript">
  28. $.extend($.fn.validatebox.defaults.rules, {
  29. confirmPass: {
  30. validator: function(value, param){
  31. var pass = $(param[0]).passwordbox('getValue');
  32. return value == pass;
  33. },
  34. message: 'Password does not match confirmation.'
  35. }
  36. })
  37. </script>
  38. </body>
  39. </html>