Toggle select options w/jQuery
<p>I have selector with multiple option grouped into option groups. I am trying to toggle select/deselect of all options when an optgroup label is clicked.</p>

<p>It works fine on initial load, but I also have a functionality that allows me to copy options from one selector to another and back. Once options are copied my toggle stops working.</p>

<pre><code>$("optgroup").toggle(function(){
    $(this).children().attr("selected", "selected");
}, function() {
    $(this).children().attr("selected", false);
});
</code></pre>

<p>Here's the <a href="http://jsfiddle.net/SwrVK/6/" rel="nofollow">copy/remove script</a>.</p>
