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");