JQuery- remove and add back certain options in a select
<p>I have this select that is constantly changing (adding, removing, etc)...</p>

<p>It goes something like this:</p>

<pre><code>&lt;select class="validation" id="6401e0f3802aa3c1d76feca811b3c43c" name="attribute[75]"&gt;
&lt;option value="109"&gt;Leather 1000&lt;/option&gt;
&lt;option value="111"&gt;Leather 2000 (+$300.00)&lt;/option&gt;
&lt;option value="112"&gt;Leather 3000 (+$400.00)&lt;/option&gt;
&lt;option value="113"&gt;Leather 5000 (+$500.00)&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>I am using jQuery to strip out all the color options, which looks like this:</p>

<pre><code>&lt;select class="validation" id="" name="attribute[76]"&gt;
&lt;option value="210"&gt;1000-Black&lt;/option&gt;
&lt;option value="211"&gt;2000-Black&lt;/option&gt;
&lt;option value="212"&gt;3000-Black&lt;/option&gt;
&lt;option value="213"&gt;5000-Black&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>The number before the color corresponds with the leather type.  My problem is that there are several hundred color options per leather type.  </p>

<p>I am currently using this plugin:</p>

<pre><code>(function($){

$.fn.extend({detachOptions: function(o) {
    var s = this;
    return s.each(function(){
        var d = s.data('selectOptions') || [];
        s.find(o).each(function() {
            d.push($(this).detach());
        });
        s.data('selectOptions', d);
    });
}, attachOptions: function(o) {
    var s = this;
    return s.each(function(){
        var d = s.data('selectOptions') || [];
        for (var i in d) {
            if (d[i].is(o)) {
                s.append(d[i]);
                console.log(d[i]);
                // TODO: remove option from data array
            }
        }
    });
}});   

})(jQuery);
</code></pre>

<p>To strip out all other options, including the colors.  Currently I have fabric choices and colors working ok, but I need to remove and add only certain colors, and I need it to work automatically.</p>

<p>What I need to do is when Leather 1000 is selected, I need ONLY the color options that have 1000- in it.</p>

<p>Can anyone help me with this?</p>
