zoukankan      html  css  js  c++  java
  • EasyUI

    -自定义下拉组件,有别于ComboBox下拉组件。

    效果:

    html代码:

    <input id ="box" />
    <div id ="fruits" style ="padding:5px;">
        <div>请选择一种水果:</div>
        <div>
            <input type ="radio" name ="fruit" value ="01"/><span>苹果</span><br />
            <input type ="radio" name ="fruit" value ="02"/><span>香蕉</span><br />
            <input type ="radio" name ="fruit" value ="03"/><span>橘子</span><br />
            <input type ="radio" name ="fruit" value ="04"/><span>芒果</span><br />
        </div>
    </div>

    JS代码:

    $(function () {
        $('#box').combo({
            // * 集成自ValidateBox *
            required: true,
            editable: false,
            delay:100,
            missingMessage:'请选择值!',
        })
    
        //将内容添加到Combo组件中
        $('#fruits').appendTo($('#box').combo('panel'));
    
        //点击选项在文本框中显示值
        $('#fruits input').click(function () {
            var v = $(this).val();//获取选中radio的value值
            var s = $(this).next('span').text();//获取选中radio的text值
            //将获取的值,设置到文本框的text,value中,并隐藏panel
            $('#box').combo('setValue', v).combo('setText', s).combo('hidePanel');
        })
    
    })
  • 相关阅读:
    25 Groovy 相关资料
    24 使用Maven 或 Gradle构建groovy
    UVA
    UVA
    UVA
    UVA
    UVA
    【JZOJ4235】序列【数论,数学】
    【JZOJ4235】序列【数论,数学】
    【JZOJ5230】队伍统计【状压DP】
  • 原文地址:https://www.cnblogs.com/KTblog/p/4907056.html
Copyright © 2011-2022 走看看