Can I open a dropdownlist using jQuery

后端 未结 14 1447
终归单人心
终归单人心 2020-11-22 09:49

For this dropdownlist in HTML:


I would lik

相关标签:
14条回答
  • 2020-11-22 10:13

    One thing that this doesn't answer is what happens when you click on one of the options in the select list after you have done your size = n and made it absolute positioning.

    Because the blur event makes it size = 1 and changes it back to how it looks, you should have something like this as well

    $("option").click(function(){
        $(this).parent().blur();
    });
    

    Also, if you're having issues with the absolute positioned select list showing behind other elements, just put a

    z-index: 100;
    

    or something like that in the style of the select.

    0 讨论(0)
  • 2020-11-22 10:14

    It is not possible for javascript to "click" on an element (u can trigger the attached onclick event, but you can't literally click it)

    To view all the items in the list, make the list a multiple list and increase its size, like such:

    <select id="countries" multiple="multiple" size="10">
    <option value="1">Country</option>
    </select>
    
    0 讨论(0)
提交回复
热议问题