jqueryhideselect-menu

jQuery hide selectMenu?


I'm using jQuery's selectMenu on a select tag like this.

$('#ddlReport').selectmenu()

in certain cases I want to hide it, and I can't figure out how.

this doesn't work:

$('#ddlReport').selectmenu().hide();

neither does this

$('#ddlReport').hide();

anyone?


Solution

  • Looking at the demos here and here, it seems selectmenu works by appending a

    <span class="ui-selectmenu-button">
    or (probably different selectmenu versions?)
    <a ... class="ui-selectmenu ...">
    

    after the original select, containing the artificial select.

    You could try accessing that using

    $('#ddlReport').next('.ui-selectmenu .ui-selectmenu-button').hide();
    

    Though it sounds like it may use other classes (instead of -button). This is also a kind of hackish workaround and I'm sure the plugin contains some way intended to let you access the newly appended menu.

    Edit: Looking through the code in the second demo, it doesn't seem like there is any preprogrammed way to access the new select in that version at least.