Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有多个选择(下拉列表)的表单。
我希望所有这些都具有最大宽度:300px,我尝试了这个,但没有工作:
$(#myform 'select').css(width, '300px');
你的语法错误
$('#myform select').css(width, '300px');
但无论如何你都可以用纯 CSS 做到这一点
#myform select{ width:300px; }
在 jQuery 中它应该是:
$('#myform select').css('max-width', '300px');
和纯 CSS:
#myform select{ max-width:300px; }