最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to set a size of a select drop down menu in jQuery - Stack Overflow

programmeradmin1浏览0评论

The normal way to do this would be:

var resultSelect = document.getElementById("resultSelect");
resultSelect.size = 3;

How do i do this in jQuery?

The normal way to do this would be:

var resultSelect = document.getElementById("resultSelect");
resultSelect.size = 3;

How do i do this in jQuery?

Share Improve this question edited Dec 20, 2014 at 22:58 rtruszk 3,92213 gold badges39 silver badges53 bronze badges asked Oct 1, 2010 at 6:02 denormalizerdenormalizer 2,2143 gold badges25 silver badges36 bronze badges 2
  • possible duplicate of Using jQuery, how can I dynamically set the size attribute of a select box? – Felix Kling Commented Oct 1, 2010 at 6:11
  • Hi Felix. I didn't see it as one of the suggestions when asking the question. It definitely is a duplicate :) – denormalizer Commented Oct 5, 2010 at 1:09
Add a ment  | 

2 Answers 2

Reset to default 3

Something like:

$("#resultSelect").attr('size', '3');
$('#mySelect').attr('size', value)

Using jQuery, how can I dynamically set the size attribute of a select box?

发布评论

评论列表(0)

  1. 暂无评论