title: jQuery Dialog Setting Radio Checked Issue
body: <p>I have a problem where by I want to remember the checked radio button in a jQuery UI dialog popup.</p>
  
  <p>I encountered some strange behaviour so I mocked it up in JSFiddle. The fiddle basically randomly selects one of 3 radio choices when its created. However it soon beings to stop working.</p>
  
  <p>I've tried with and without the line that does removeAttr('checked') as well.</p>
  
  <p>You will need to click open dialog and close it several times to see it stop working. I have been testing this in the latest version of Chrome.</p>
  
  <p><a href="http://jsfiddle.net/t8kN7/5/" rel="nofollow">http://jsfiddle.net/t8kN7/5/</a></p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div id="dialog" style="display:none;"&gt;
  
  &lt;input type="radio" class="left" name="rentFrequency" value="1" /&gt;
  &lt;span class="left"&gt;&amp;#160;Monthly&amp;#160;&amp;#160;&amp;#160;&lt;/span&gt;
  
  &lt;input type="radio" class="left" name="rentFrequency" value="2" /&gt;
  &lt;span class="left"&gt;&amp;#160;Quarterly&amp;#160;&amp;#160;&amp;#160;&lt;/span&gt;
  
  &lt;input type="radio" class="left" name="rentFrequency" value="3" /&gt;
  &lt;span class="left"&gt;&amp;#160;Annualy&amp;#160;&amp;#160;&amp;#160;&lt;/span&gt;                                
  
  &lt;/div&gt;
  
  &lt;input type="button" name="dialogOpen" value="Open Dialog" /&gt;
  &lt;input type="text" name="randVal" value="" readonly="readonly" /&gt;
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>$(document).ready(function() {
  
  $('input[name="dialogOpen"]').click(function(){
      $("#dialog").dialog({
          title: 'Additional Tenancy Information',
          resizable: false,
          width: 530,
          show: { effect:'fade', duration:500 },
          hide: { effect:'fade', duration:400},           
          modal: true,
          close: function (event, ui) {
          },
          open: function (event, ui) {
              var randval=Math.floor(Math.random()*3)+1
              console.log(randval); 
              $('input[name="randVal"]').val(randval);
              $('input[name="rentFrequency"]').removeAttr('checked');
              $('input[name="rentFrequency"][value="'+randval+'"]').attr('checked', 'checked');
          }
      });
  });
  });
  </code></pre>
  
  <p>This is effectively the same code just without the dialog popup and it behaves as expected:</p>
  
  <p><a href="http://jsfiddle.net/W6rFh/1/" rel="nofollow">http://jsfiddle.net/W6rFh/1/</a></p>
  
  <p>Just keeping clicking on RUN</p>