Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save adipasquale/1053321 to your computer and use it in GitHub Desktop.
Save adipasquale/1053321 to your computer and use it in GitHub Desktop.
jquery.ui.selectmenu - issue - Destroy method doesn't work when using 'wrapperElement' - DEMO
<html>
<head>
<!-- same config than http://jquery-ui.googlecode.com/svn/branches/labs/selectmenu/index.html -->
<!--
<link rel="Stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-darkness/jquery-ui.css" type="text/css" />
<link rel="Stylesheet" href="jquery.ui.selectmenu.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery.ui.selectmenu-old.js"></script>
-->
<!-- new config -->
<link rel="Stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-darkness/jquery-ui.css" type="text/css" />
<link rel="Stylesheet" href="jquery.ui.selectmenu.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery.ui.selectmenu-1.1.0.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#generate").click(function(){
$("#mood-select").selectmenu({
style: 'dropdown',
wrapperElement: "<div class='smoothness'></div>"
});
});
$("#destroy").click(function(){
$("#mood-select").selectmenu('destroy');
});
});
</script>
</head>
<body>
<form>
<select id="mood-select">
<option title="title" value="">Mood</option>
<option class="angry" value="1">Angry</option>
<option class="happy" value="2" selected="">Happy</option>
<option class="very_happy" value="3">Very happy</option>
<option class="sad" value="4">Sad</option>
<option class="sleepy" value="5">Sleepy</option>
<option class="in_love" value="6">In love</option>
<option class="broken_hearted" value="7">Broken hearted</option>
<option class="missing_you" value="8">Missing you</option>
<option class="sick" value="9">Sick</option>
</select>
<br />
<input type="button" value="destroy !" id="destroy" />
<br />
<input type="button" value="generate!" id="generate" />
</form>
</body>
</html>
@ravensnowbird
Copy link

it worked for me pretty well. keep this in the input tag onclick="$("#mood-select").selectmenu('destroy');"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment