title: how to prevent to change selectbox value if i say no to confirm
body: <p>i m using a select box of country, when user select a country then add branch link appears and user add branches under that country, but when user want to change country then all branches regarding that country should be destryoed. before changing a country a confirm box appears and show warning..everything is working fine but </p>
  
  <p>if i click 'Cancel' on confirm box then branches  remains there but select box value changed to new country (even i click on cancel)</p>
  
  <p>i need that if user cancel to change country then select box value also would be previous  country.</p>
  
  <p>please tell how to do it with JQuery 
  my code is given below</p>
  
  <pre><code>&lt;form&gt;
  &lt;table&gt;
      &lt;tr&gt;
         &lt;td &gt;Select Country :&lt;/td&gt;
         &lt;td &gt;
         &lt;select name="country_id" id="country"  class="selectbox" title="Please select country" validate="required:true" onchange="javascript:showBranch();" &gt;
           &lt;option value="" &gt;Select Country &lt;/option&gt;
           &lt;option value="00002" &gt; Afghanistan&lt;/option&gt;
           &lt;option value="00054" &gt; Croatia&lt;/option&gt; 
           &lt;option value="00060" &gt; Dominica&lt;/option&gt; 
           &lt;option value="00062" &gt; Ecuador&lt;/option&gt; 
           &lt;option value="00064" &gt; El Salvador&lt;/option&gt; 
           &lt;option value="00067" &gt; Estonia&lt;/option&gt; 
           &lt;option value="00099" &gt; India&lt;/option&gt; 
         &lt;/select&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&amp;nbsp;&lt;/td&gt;
         &lt;td&gt;
          &lt;div id="branches"&gt;
          &lt;!-- Raw Branch Details--&gt;
               &lt;div&gt;&lt;span&gt;&lt;a title="First Branch" href=""&gt;First&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
               &lt;div&gt;&lt;span&gt;&lt;a title="Second Branch" href=""&gt;Second&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
               &lt;div&gt;&lt;span&gt;&lt;a title="Third Branch" href=""&gt;Third&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;                  
          &lt;/div&gt;
          &lt;div id="brancherror"&gt;&lt;/div&gt;
         &lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td align="left"&gt;
          &lt;span id="branchLink" style="display:none" &gt;
          &lt;a href="#" class="thickbox" id="branchhref"&gt;Add Branch(es)&lt;/a&gt;&lt;/span&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
   &lt;/table&gt;
   &lt;/form&gt;
  
  function showBranch()
      {   
          var countryid = jQuery('#country').val();
          if (jQuery("#branches&gt;div").size())
          {
              if (confirm('If country has been changed then data corresponding to present branches will lost.Do you want to continue?'))
              {
                  jQuery('#branches').html('');
              }
  
              jQuery('#branchhref').attr({href: "index.php?option=com_advertise&amp;view=createbranch&amp;format=raw&amp;country=" + countryid + "&amp;KeepThis=true&amp;TB_iframe=true&amp;height=500&amp;width=900",title: 'Add Branch'});
          }
  
          else
          {
              jQuery('#branchhref').attr({href : "index.php?option=com_advertise&amp;view=createbranch&amp;format=raw&amp;country=" + countryid + "&amp;KeepThis=true&amp;TB_iframe=true&amp;height=500&amp;width=900",title:'Add Branch'});
              return true;
          }
          jQuery('#branchLink').show();   
      }
  </code></pre>