javascript-dropdown option remove
<p>I have three dropdowns</p>

<pre><code>First dropdown options are

option1
option2


2nd and third dropdowns are

optionA
OptionB
</code></pre>

<p>When I select option2 in first dropdown</p>

<p>I should remove optionA from both dropdowns.</p>

<p>When I select option1, my both dropdowns should repopulate with original values.</p>

<p>I am using the following code to remove from one dropdown only</p>

<p>Can anybody point me how to do two dropdowns at same time please.</p>

<pre><code>&lt;script type="text/javascript"&gt;
google.load("jquery", "1.4.2");
google.setOnLoadCallback(function() 
{
    var sites='#firstDDId';
    $('#firstDDId').change(function() 
            {
                if($(sites).val()=='Option1' ) 
                {
                        alert(" Please note, optionA will be removed"); 
                         $("#secondDDId option[value='OptionA']").remove(); 
                                         } 
               else
                {
                  var exists = false;
                  $('#SecondDDId option').each(function()
                  {
                        if (this.value == 'OptionA') 
                        {

                            exists = true;

                            return false;
                        }
                    }
                );

                    if (exists==false)
                    {
                        $("#SecondDDId").append('&lt;option value="OptionA"&gt;OptionA&lt;/option&gt;');
                    }

                 }  
        });



  });

&lt;/script&gt;
</code></pre>
