当前端页面遇到不能改变输入框等各种框的长短属性时解决的方法

1.用cssClass属性

 //加入cssClass="tree"属性

		<label class="control-label">区域:</label>
			<div class="controls"  >
//树
<sys:treeselect id="area" name="countryArea.id" value="${projectInfo.countryArea.id}" labelName="countryArea.name" labelValue="${projectInfo.countryArea.name}"
title="Country&Area" url="/delivery/area/treeData"      expandAll="true" cssClass="tree"allowClear="true"  />
//加上一个标记
	<span class="help-inline"><font color="red">*</font> </span>
									</div>
		

  

2. 用.css("width","130px");

getSelect函数:

function getSelect(name,items,key,value,changeFunctionName){
			var select = $("<select   ></select>");
			if(name){
				select.attr("name",name);
			}
			if(changeFunctionName){
				select.attr("onchange",changeFunctionName+"()");
			}
			var emptyOption = $("<option></option>").val("").text("-select-");
			select.append(emptyOption);
			for(itemKey in items){
				var option = $("<option></option>").val(items[itemKey][value]).text(items[itemKey][key]);
				select.append(option);
			}
			return select;
		}

  

调用getSelect并且设置属性:

 var HSListSelect = getSelect("",reiHSList,"name","id");
	    HSListSelect.css("width","130px");

  

posted @ 2018-12-23 01:03  佳佳乐大本营  阅读(230)  评论(0编辑  收藏  举报