Esay UI Input控件类型取值赋值

1.Input type="hidden"

  定义:

   <input type="hidden" name="APPLYDEPTNAME" id="APPLYDEPTNAME" />

  赋值:

$("#APPLYDEPTNAME").val('1212'),

  取值:

$("#APPLYDEPTNAME").val()

 

2.Input

  a. validatebox

  定义:

   <input type="text" name="APPLYDEPTNAME" id="APPLYDEPTNAME" style="width: 99%"
                      maxlength="50" class="easyui-validatebox" data-options="required:true" />

  赋值:

$("#APPLYDEPTNAME").val('1212'),

  取值:

$("#APPLYDEPTNAME").val()

 3 .ComboBox

  取值:

 $("#city2").combobox("getValues");//获取多个值选中,类型是数组
 
 $("#city2").combobox("getValue");//获取单个值,选中
 

 

  赋值:

复制代码
 $('#city').combobox('setValue', ‘北京’);

回显:
//公司地址
var str4 = result.APPLYDEPTADDRESS;
if (str4 != null) {
var strs4 = new Array();
strs4 = str4.split(",");
$('#city').combobox('setValue', strs4[0]);
var url = '../../Ajax/InforService.ashx?Method=GetArea&CityAreaCode=' + strs4[0];
$('#area').combobox('reload', url);
$('#area').combobox('setValue', strs4[1]);
$("#APPLYDEPTADDRESS").val(strs4[2]);
}

复制代码

 

默认选择第一项,加请选择,取值问题

复制代码
<input class="easyui-combobox" id="ddlWHS" name="ddlWHS" />


 //combox默认选择第一个
                        $(function () {
                            $('#ddlWHS').combobox({
                                url: "../../HR/attType/list_attType.ashx?type=Bindddl",
                                valueField: 'WorkingHour_beginTime',
                                textField: 'WorkingHour_name',
                                editable: false,
                                onLoadSuccess: function (data) {
                                    var data = $('#ddlWHS').combobox('getData');
                                    if (data.length > 0) {
                                        $("#ddlWHS").combobox('select', data[0].WorkingHour_beginTime);
                                    }
                                }
                            });
                        });

                       //    combox加请选择 
                        $(function () {
                            $('#ddlWHS').combobox({
                                url: "../../HR/attType/list_attType.ashx?type=Bindddl",
                                valueField: 'WorkingHour_beginTime',
                                textField: 'WorkingHour_name',
                                editable: false,
                                //返回要显示的过滤数据
                                loadFilter: function (data) {
                                    var o = [{ 'WorkingHour_beginTime': '0', 'WorkingHour_name': '--请选择--'}];
                                    return o.concat(data);
                                },
                                //当远程数据加载成功时触发 
                                onLoadSuccess: function (data) {
                                    var data = $('#ddlWHS').combobox('getData');
                                    if (data.length > 0) {
                                        $("#ddlWHS").combobox('select', data[0].WorkingHour_beginTime);
                                    }
                                },
                                onSelect: function (record) {
                                  //获取values
                                   alert($("#ddlWHS").combobox("getValues"));
                                  // 获取text
                                   alert($("#ddlWHS").combobox("getText"));
                                }

                            });
                        });
复制代码

3. checkbox

多个复选框获取选中checked的值用“,”分割,name='qx'

 var qx = $("input[name='qx']:checked").map(function () {
                return $(this).val();
            }).get().join(',');

 

$("input[name='qx']:checked").removeAttr("checked"); //取消选中

 

c.NumberBox

定义:

<input type="text" class="easyui-numberbox" maxlength="20" name="nn" id="nn" />

赋值:

$('#nn').numberbox('setValue', 206.12);

取值:

var v = $('#nn').numberbox('getValue');


d.DateBox

 

定义:

 <input type="text" name="nn" id="nn" class="easyui-datebox"
                        data-options="formatter:myDate.InitDateBox.formatter,parser:myDate.InitDateBox. parser" />

赋值:

 $("#SC001_CERTIFICATEVALID").datebox('setValue', '2014-9-12');

取值:

 $('#nn').datebox('getValue'),

e.NumberSpinner 

定义:
<input id="ss" class="easyui-numberspinner" style="width:80px;"  
        required="required" data-options="min:10,max:100,editable:false">  
赋值:
$('#ss').numberspinner('setValue', 8234725);  
取值:
var v = $('#ss').numberspinner('getValue');  

f.menubutton

定义:

 <a href="javascript:void(0)" id="mb" name="mb" disabled="true" class="easyui-menubutton"   
              data-options="menu:'#mm',iconCls:'icon-edit' ">确认</a>  
              <div id="mm" name="mm"style="width:150px;">  
              <div data-options="iconCls:'icon-undo'" οnclick="initTool.Check('确认通过')">确认通过</div>  
              <div data-options="iconCls:'icon-redo'" οnclick="initTool.Check('确认不通过')">确认不通过</div>
              </div>

 

另附单选按钮Radio

定义

 <td height="30" colspan="5">
                    <input type="radio" name="APPLYDEPTTYPE" value="事业法人" checked="checked" />事业法人
                    <input type="radio" name="APPLYDEPTTYPE" value="企业法人" />企业法人
                    <input type="radio" name="APPLYDEPTTYPE" value="社团法人" />社团法人
                    <input type="radio" name="APPLYDEPTTYPE" value="其他" />其他
                </td>

赋值:

 var str = result.APPLYDEPTTYPE;
 $("[value='" + str + "']").attr("checked", true);

取值:

$('input[name="APPLYDEPTTYPE"]:checked').val()

另附多选框checkbox

定义:

复制代码
 <td height="60" colspan="5">
                    &nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp
                    <input type="checkbox" name="BUSINESSSCOPE" value="" />水 &nbsp&nbsp&nbsp&nbsp
                    &nbsp&nbsp&nbsp&nbsp
                    <input type="checkbox" name="BUSINESSSCOPE" value="空气" />空气 &nbsp&nbsp&nbsp&nbsp
                    &nbsp&nbsp&nbsp&nbsp
                    <input type="checkbox" name="BUSINESSSCOPE" value="土壤" />土壤</br>
                    &nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp
                    <input type="checkbox" name="BUSINESSSCOPE" value="噪声" />
                    噪声 &nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp
                    <input type="checkbox" name="BUSINESSSCOPE" value="生物" />生物
                </td>
复制代码

 

赋值:

复制代码
  var str3 = result.BUSINESSSCOPE;
                    if (str3 != null) {
                        var strs = new Array();

                        strs = str3.split(",");
                        for (i = 0; i < strs.length; i++)
                        { $("[value='" + strs[i] + "']").attr("checked", true) };
                    }
复制代码

取值:

复制代码
 var isc = "";
                $("input[name='BUSINESSSCOPE']:checked").each(function () { //遍历table里的全部checkbox
                    isc += $(this).val() + ","; //获取被选中的值
                });

                if (isc.length > 0) //如果获取到
                    isc = isc.substring(0, isc.length - 1); //把最后一个逗号去掉
string isc就是值
复制代码

 

2.TextArea

  定义:

1
<textarea cols= "25"   rows= "3"   name= "BUSINESSALLOW"   id= "BUSINESSALLOW"   onpropertychange= "if(this.value.length>100){this.value=this.value.substr(0,100)}"   class = "easyui-validatebox"   style= "width: 99%; height: 99%"   data-options= "required:true" ></textarea>

赋值和取值与Input标签相同。

 

 3,获取文本框选中内容

$("input", $("#CXTJ").next("span")).select();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值