icons.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>TextBox with Icons - 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>TextBox with Icons</h2>
  14. <p>Click the icons on textbox to perform actions.</p>
  15. <div style="margin:20px 0 40px 0;"></div>
  16. <div style="margin:10px 0 20px 0">
  17. <span>Select Icon Align: </span>
  18. <select onchange="$('#tt').textbox({iconAlign:this.value})">
  19. <option value="right">Right</option>
  20. <option value="left">Left</option>
  21. </select>
  22. </div>
  23. <div class="easyui-panel" style="width:100%;max-width:400px;padding:30px 60px;">
  24. <div style="margin-bottom:20px">
  25. <input id="tt" class="easyui-textbox" style="width:100%;" data-options="
  26. label: 'Icons:',
  27. labelPosition: 'top',
  28. prompt: 'Input something here!',
  29. iconWidth: 22,
  30. icons: [{
  31. iconCls:'icon-add',
  32. handler: function(e){
  33. $(e.data.target).textbox('setValue', 'Something added!');
  34. }
  35. },{
  36. iconCls:'icon-remove',
  37. handler: function(e){
  38. $(e.data.target).textbox('clear');
  39. }
  40. },{
  41. iconCls:'icon-search',
  42. handler: function(e){
  43. var v = $(e.data.target).textbox('getValue');
  44. alert('The inputed value is ' + (v ? v : 'empty'));
  45. }
  46. }]
  47. ">
  48. </div>
  49. </div>
  50. </body>
  51. </html>