Skip to content Skip to sidebar Skip to footer

Open A Select Drop Down On Click Of Checkbox Using Jquery

I have a drop down say and a check box,

Solution 1:

EDIT: From mithunsatheesh's answer, I have integrated the doClick function here:

var doClick = function() {
    'use strict';
    var event = document.createEvent('MouseEvents');
    event.initMouseEvent('mousedown', true, true, window);
    return event;
};

$('.hear').click(function() {
    'use strict';
    $('#countries').focus().get(0).dispatchEvent(doClick());
});

See jsFiddle. Please note that it only works in Chrome (WebKit).

Also, you may wish to bind to the change event.

Post a Comment for "Open A Select Drop Down On Click Of Checkbox Using Jquery"