1

i need to simulate a click event on a select element to show the options. i found this http://jsfiddle.net/joya/rD3nn/ but it don't work in chrome and firefox. In safari it works.

this is my code:

$(document).on('keypress', function (e) {
    if(e["keyCode"] == 13){

        //Bei Enter-Eingabe das Dropdown öffnen
        var elem = $('#select');
        if (document.createEvent) {
            var e = document.createEvent("MouseEvents");
            e.initMouseEvent("click", 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");
        }

    }
});

how i can solve this problem for chrome and firefox ?

Pla558
  • 291
  • 5
  • 15

0 Answers0