首页 > 其他 > 详细

EasyUI - Combo组件

时间:2015-10-24 17:25:04      阅读:375      评论:0      收藏:0      [点我收藏+]

-自定义下拉组件,有别于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);
    })

})

 

EasyUI - Combo组件

原文:http://www.cnblogs.com/KTblog/p/4907056.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!