title: jQuery modal dialog with checkbox and link
body: <p>Been trying to figure this out for days (trials of being a novice, me thinks!) so your help would be very welcome. </p>
  
  <p>A jscript widget displays a Continue button. When user clicks the button I need a modal dialog to display a message (containing a hyperlink to an agreement doc) and a checkbox for the user to confirm they've read an agreement. After closing the dialog, if <code>checkbox = 0</code> then the Continue button opens the same dialog (loop, until checkbox is clicked: <code>checkbox = 1</code>).</p>
  
  <p>Here's the code I've gathered together so far... </p>
  
  <p>For the dialog:</p>
  
  <pre><code>&lt;a href="#" id="sdHc3" rel="simpleDialog3"&gt;Click to open dialog&lt;/a&gt;  
  &lt;span style="display:none;" id="checkboxStatus"&gt;&lt;/span&gt;
  
  &lt;div style="display:none;" id="simpleDialog3"&gt;
      &lt;h3&gt;Terms and Conditions&lt;/h3&gt;
      &lt;form id="checkboxForm"&gt;
          Please check box to confirm that you have read the &lt;a href="assets/docs/agreement.html"&gt;agreement&lt;/a&gt;: &lt;input type="checkbox" class="chckbx" value="1" /&gt;
      &lt;/form&gt;
      &lt;p&gt;&lt;a href="#" class="close"&gt;Close&lt;/a&gt;&lt;/p&gt;
  &lt;/div&gt;
  
  
  &lt;script type="text/javascript"&gt;
  $('#sdHc3').simpleDialog({
      showCloseLabel: false,
      open: function () {
          $('#checkboxStatus').html('');
      },
      close: function () {
          var c = [];
          $('#checkboxForm :checkbox:checked').each(function () {
              c.push($(this).val());
          });
          $('#checkboxStatus').html('Checked ' + c.join(', ') + '.').show();
      }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>and for detecting a click on the widget button:</p>
  
  <pre><code>&lt;script type = "text/javascript"&gt;
  document.body.onmousedown = function (e) {
      var query = window.location;
      var anchor1=query.hash.substring(1); //anchor without the # character
      if( ($(event.target).hasClass("gwt-Button")) &amp;&amp; (anchor1=="step3"))
      {
          alert("Widget button clicked");
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>The 'dialog' code works ok and the widget button click detection code also works well. It's currently a mystery to me though how to bring these together and achieve the goal. Thanks in advance!</p>