-2

I cant find a way to just trigger select option to just show the dropdown list only. I know how to set a val for select but i just need to show the dropdown.

I want to just show the dropdown list, keep it open.

JyotiChhetri
  • 289
  • 1
  • 7
  • 21

1 Answers1

0

It's possible with some tricky code.

$(document).ready(function() {
    open($('select'));
});

function open(elem) {
    if (document.createEvent) {
        var e = document.createEvent("MouseEvents");
        e.initMouseEvent("mousedown", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
        elem[0].dispatchEvent(e);
    } else if (element.fireEvent) {
        elem[0].fireEvent("onmousedown");
    }
}

See this JSFiddle

From: Simulate click on select element with jQuery

Community
  • 1
  • 1
Jacques Marais
  • 188
  • 1
  • 8