How to select an option in a jQuery ui selectmenu dynamically?

后端 未结 6 1279
别跟我提以往
别跟我提以往 2021-02-18 21:44

After changing a menu from a regular select to a jQuery selectmenu, I can no longer select options in it programatically. Is there a way to do this?

The code to select

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-18 22:41

    I have tried the following ways, and it does work in my situation

    $('#ListId').find('option[value=""]').attr("selected", true);    
    

    OR

    $('#ListId').prop('selectedIndex', 0);
    

提交回复
热议问题