jqTransform下拉框不显示的bug及下拉框动态赋值

js源文件 jquery.jqtransform.js

//下拉框不显示的bug修改在源码中添加如下代码

  iSelectHeight = (iSelectHeight == 0 ? ($('li',$ul).length * 24) : iSelectHeight);  

//具体添加位置在下面这行代码下边 

 var iSelectHeight = ($('li',$ul).length)*($('li:first',$ul).height());//+1 else bug ff  

JSP页面中代码

<td>
	<span class="title">催转类型:</span>
	<select id="ywlx" name="_html_ywlx" style="width:130px;height:18px" >
	    <option value="">--请选择--</option>
	    <option value="JH"><spring:message code="powdersecurity.iiSmsSet.czlx.jh"></spring:message></option>
	    <option value="XF"><spring:message code="powdersecurity.iiSmsSet.czlx.xf"></spring:message></option>
	</select>
	<input type="hidden" id="ywlxIp" value="<%=(String) request.getAttribute("_html_ywlx") != null ? (String) request.getAttribute("_html_ywlx"): ""%>"/>
/td>

js的方法

var ywlxxl=$("#ywlxIp").val();
var text =$("#ywlx option[value='"+ywlxxl+"']").text(); 
if(ywlxxl!=""){
    var ul =$("#ywlx").prev(); 
    ul.find('a').removeClass('selected');  
    ul.find('a:contains("' + text + '")').addClass('selected');  
    ul.prev().find('span').text(text);  
}

猜你喜欢

转载自blog.csdn.net/codeLife1993/article/details/80941571
今日推荐