basic.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Basic Combo - 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>Basic Combo</h2>
  14. <p>Click the right arrow button to show drop down panel that can be filled with any content.</p>
  15. <div style="margin:20px 0"></div>
  16. <div class="easyui-panel" style="width:100%;max-width:400px;padding:30px 60px;">
  17. <div style="margin-bottom:20px">
  18. <input id="cc" style="width:100%;">
  19. </div>
  20. </div>
  21. <div id="sp">
  22. <div style="line-height:22px;background:#fafafa;padding:5px;">Select a language</div>
  23. <div style="padding:10px">
  24. <input type="radio" name="lang" value="01"><span>Java</span><br/>
  25. <input type="radio" name="lang" value="02"><span>C#</span><br/>
  26. <input type="radio" name="lang" value="03"><span>Ruby</span><br/>
  27. <input type="radio" name="lang" value="04"><span>Basic</span><br/>
  28. <input type="radio" name="lang" value="05"><span>Fortran</span>
  29. </div>
  30. </div>
  31. <script type="text/javascript">
  32. $(function(){
  33. $('#cc').combo({
  34. required:true,
  35. editable:false,
  36. label:'Language:',
  37. labelPosition:'top'
  38. });
  39. $('#sp').appendTo($('#cc').combo('panel'));
  40. $('#sp input').click(function(){
  41. var v = $(this).val();
  42. var s = $(this).next('span').text();
  43. $('#cc').combo('setValue', v).combo('setText', s).combo('hidePanel');
  44. });
  45. });
  46. </script>
  47. </body>
  48. </html>