Semantic-ui: How to undo or destroy dropdown keeping original select

Created on 1 Jun 2016  路  3Comments  路  Source: Semantic-Org/Semantic-UI

How to undo or destroy dropdown keeping original select? For example if I have a regular <select> with options and I call $('select').dropdown(), then how can I revert back to the standard <select>? I'm asking because calling the dropdown function wraps a bunch of code and I need to re-render it with new options

Usage Question

All 3 comments

There are mutation observers to watch the original select and update the menu when the select options change. You can also call refresh menu.

jQuery Hack;

$.fn.destroyDropdown = function() {
    return $(this).each(function() {
        $(this).parent().dropdown( 'destroy' ).replaceWith( $(this) );
    });
};
$('select').destroyDropdown();

jQuery Hack;

$.fn.destroyDropdown = function() {
  return $(this).each(function() {
      $(this).parent().dropdown( 'destroy' ).replaceWith( $(this) );
  });
};
$('select').destroyDropdown();

Not have Behavior destroy...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Morrolan picture Morrolan  路  3Comments

arj-196 picture arj-196  路  3Comments

deneuxa picture deneuxa  路  3Comments

mllamazares picture mllamazares  路  3Comments

ghost picture ghost  路  3Comments