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
2 Answers
Reset to default 3Something like:
$("#resultSelect").attr('size', '3');
$('#mySelect').attr('size', value)
Using jQuery, how can I dynamically set the size attribute of a select box?