How to dynamically trigger select dropdown to open the values, except changing the attribute values as length of option value. I want to trigger the select dropdown (right arrow) dynamically is that any way ?
HTML:
<div>
<input type="text" />
</div>
<div>
<select id="testSelect" onfocus="openDrpDown(this)" onblur="closeDrpDown(this)">
<option>11111</option>
<option>222222</option>
<option>444444444</option>
<option>55555</option>
</select>
</div>
Script:
function openDrpDown(){
//var myDropDown=$("#testSelect");
//var length = $('#testSelect > option').length;
//open dropdown
//myDropDown.attr('size',length);
$("#testSelect").click();
}
function closeDrpDown(){
//var myDropDown=$("#testSelect");
//var length = $('#testSelect > option').length;
//close dropdown
//myDropDown.attr('size',0);
}