大家好,我正在使用outerWidth()
获取字段width
属性的方法input type="text"
。这是我在搜索框中设置的,它在localhost上正确设置,但在服务器上没有正确设置,任何人都可以帮助我的问题。在代码中这是输入框,谢谢
var search_id = $(this).attr('id');
var width = $(this).outerWidth();
<div id="total_div_'+search_id+'" tabindex="0" style="width:'+width+';max-height:230px
你需要像下面这样
$("#total_div_").css("width",""+ width +"px");
您的代码是错误的,您正在尝试通过样式添加宽度可变,而样式无法正常工作,因此请尝试如上
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句