user168507
user168507

Reputation: 881

jquery how to re-detach a detach on option

I need help concerning following code: http://jsfiddle.net/8PsdE/

<SELECT ID="pizzasize" NAME="pizzasize">
<OPTION VALUE="s">small
<OPTION VALUE="m">medium
<OPTION VALUE="l">large
</SELECT>

    $(function() {
   $('#pizzasize > option[value*="m"]').detach();
});

How can I add the detached option back again? Thx in advance...

Upvotes: 0

Views: 876

Answers (1)

Oded
Oded

Reputation: 499202

Get a reference to the options you have selected, then you can detach them or do anything else with them using that reference:

$(function() {
  var theOptions = $('#pizzasize > option[value*="m"]');
  theOptions.detach();

  // Do other things with theOptions
});

Upvotes: 1

Related Questions