customtooltip.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Custom ValidateBox Tooltip - 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>Custom ValidateBox Tooltip</h2>
  14. <p>This sample shows how to display another tooltip message on a valid textbox.</p>
  15. <div style="margin:20px 0;"></div>
  16. <div class="easyui-panel" title="Register" style="width:100%;max-width:400px;padding:30px 60px;">
  17. <div style="margin-bottom:20px">
  18. <label for="username" class="label-top">User Name:</label>
  19. <input id="username" class="easyui-validatebox tb" data-options="prompt:'Enter User Name.',required:true,validType:'length[3,10]'">
  20. </div>
  21. <div style="margin-bottom:20px">
  22. <label for="email" class="label-top">Email:</label>
  23. <input id="email" class="easyui-validatebox tb" data-options="prompt:'Enter a valid email.',required:true,validType:'email'">
  24. </div>
  25. <div style="margin-bottom:20px">
  26. <label for="url" class="label-top">Url:</label>
  27. <input id="url" class="easyui-validatebox tb" data-options="prompt:'Enter your URL.',required:true,validType:'url'">
  28. </div>
  29. <div style="margin-bottom:20px">
  30. <label for="phone" class="label-top">Phone:</label>
  31. <input id="phone" class="easyui-validatebox tb" data-options="prompt:'Enter your phone number.',required:true">
  32. </div>
  33. </div>
  34. <style scoped="scoped">
  35. .tb{
  36. width:100%;
  37. margin:0;
  38. padding:5px 4px;
  39. border:1px solid #ccc;
  40. box-sizing:border-box;
  41. }
  42. </style>
  43. <script>
  44. $(function(){
  45. $('input.easyui-validatebox').validatebox({
  46. validateOnCreate: false,
  47. err: function(target, message, action){
  48. var opts = $(target).validatebox('options');
  49. message = message || opts.prompt;
  50. $.fn.validatebox.defaults.err(target, message, action);
  51. }
  52. });
  53. });
  54. </script>
  55. </body>
  56. </html>