How to remove UI selectmenu in jquery?

The code below sets a select menu with UI selectmenu by

$('.anyclass').selectmenu();

but the question here is how to remove UI selectmenu of .anyclass

Answers


In case you are talking about this plugin, you can simple do this

$('.anyclass').selectmenu('destroy');

You can remove an element by:

$('.anyclass').remove();

To remove a particular class:

$('.anyclass').removeClass('addedClass');  // where addedClass is something a plugin would add

To change a css attribute:

$('.anyclass').css('color', 'blue');

UI Selectmenu creates an imitation of the button and menu for the select box and hides the actual select tag. There's no such thing as removing the styling in this case. All you can do is get rid of the imitation select box and display the actual select tag.

If the select tag has an id of foo, then the imitation button and menu have an id of foo-button and foo-menu, respectively.

$('#foo-button').remove();   // or .hide()
$('#foo-menu').remove();     // or .hide()
$('#foo').show();

Please do not use the above linked version of the plugin as its totally outdated and has lots (!) of issues.

Please use https://github.com/fnagel/jquery-ui/tree/selectmenu/ui (jQuery UI stable) or https://github.com/jquery/jquery-ui/tree/selectmenu (jQuery UI dev)


Need Your Help

Travis CI builds failing - Phantom JS timing out with Mocha

typescript phantomjs mocha travis-ci

I'm using Travis CI to automate unit testing for a Typescript project. Everything runs fine locally, but on Travis the following error message pops up at the end:

What happens in the foreach loop, which outputs the values of an array?

c# class foreach iteration ienumerable

I'm learning C and C#, this question is for C#. I have a instance of a class and I use a foreach loop to iterate through the values of "string[] days", but how does this happen? The class has a met...