javascript – How can i programmatically show the dropdown menu of a select with JQuery?-ThrowExceptions

Exception or error:

I have an HTML Helper @HTML.DropDownList(), in which when receives focus, via JQuery .on(‘focus’), i want to show the options menu, how can i do that using JQuery or pure javascript code,

What have tried so far is trigerring the onclick event on the dropdownlist and assigning the css property, for the option elements associated to the dropdownlist element, to ‘display’ ‘block’ as below:

                $('#ddlCuSim').trigger('click');
            $('#ddlCuSim').find('option').css('display', 'block');

The suggestion included in Click trigger on select box doesn’t work in jQuery
doesn’t help as what i want to achieve is to show the options dropdown menu rather than assigning the dropdownlist val

Please Advise!
Thanks in advance

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *