-2

Actually I have 500 items & I want to show only 10 items in the dropdown, rest of the items will be shown in the scroll bar.

How to obtain in jquery or js ? Same question have been raised by other & I read all the comments given, still than I could not able to solve the problem.

Your help is highly appreciated.

Mayur Prajapati
  • 5,454
  • 7
  • 41
  • 70
  • 1
    You read answers to similar questions and where is your best try? Show some code please! – Lelio Faieta Dec 27 '17 at 09:48
  • 1
    Possible duplicate of [Limiting options in select dropdown to a specific number](https://stackoverflow.com/questions/38303813/limiting-options-in-select-dropdown-to-a-specific-number) – NewToJS Dec 27 '17 at 10:03

1 Answers1

1

Try this snippet. Is this what you are looking for?

<select id=ddown onmousedown="if(this.options.length>10){this.size=10;}"  onchange='this.size=0;' onblur="this.size=0;">
<option value=1>14444</option>
<option value=2>1345</option>
<option value=3>139</option>
<option value=4>155</option>
<option value=5>19</option>
<option value=6>18</option>
<option value=7>17</option>
<option value=8>16</option>
<option value=9>15</option>
<option value=10>14</option>
<option value=11>13</option>
<option value=12>12</option>
<option value=13>11</option>
</select>
  • The least you could do is give credit to the post you found this source code on rather than just a copy/paste with no information. [**Limiting options in select dropdown to a specific number**](https://stackoverflow.com/questions/38303813/limiting-options-in-select-dropdown-to-a-specific-number#answer-38303984) – NewToJS Dec 27 '17 at 10:02
  • i have used it many times. I knew it not a copy paste my friend –  Dec 27 '17 at 10:17