title: How to revert back to previous select list option in dropdown using jquery?
body: <p>I asked similar question in another thread but that what I was not helpful. So here I create a duplicate as the real one that I am using in my real project. </p>
  
  <p>You can find my stuff in this <a href="http://jsfiddle.net/vvjj8/3591/" rel="nofollow">fiddle</a></p>
  
  <pre><code>function fnOpenNormalDialog() {
      $("#dialog-confirm").html("Confirm Dialog Box");
  
      // Define the Dialog and its properties.
      $("#dialog-confirm").dialog({
          resizable: false,
          modal: true,
          title: "Modal",
          height: 250,
          width: 400,
          buttons: {
              "Yes": function () {
                  $(this).dialog('close');
                  //callback(true);
              },
                  "No": function () {
                  $(this).dialog('close');
                  callback();
              }
          }
      });
  }
  
  $('#btnOpenDialog').click(fnOpenNormalDialog);
  
  function callback() {
      $("#changer").val(lastValue); // this one doesn't work.
      // $("#changer").val('value1'); // This one works fine 
  }
  
  var lastValue;
  
  $('#changer').bind("click", function(e) {
              lastValue = $(this).val();
  
          }).bind("change", function (e){
            fnOpenNormalDialog();
          });
  </code></pre>
  
  
  
  <pre><code>&lt;select id="changer"&gt;
      &lt;option value="value1"&gt;Value 1&lt;/option&gt;
      &lt;option value="value2"&gt;Value 2&lt;/option&gt;
      &lt;option value="value3"&gt;Value 3&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>What I am trying to do is when user click cancel button I want revert back to original selected option in drop down.</p>