title: Jquery, get dynamic attribute for dialog box
body: <p>This is an extension to a previous question which was answered. But have a different need/issue. Here is the jquery code:</p>
  
  <pre><code>$("#deletec-box").dialog({
      autoOpen: false,
      resizable: false,
      height:230,
      modal: true,
      buttons: {
          "Confirm": function() {
              window.location = $('#deletec-confirm').attr('href');
              $(this).dialog("close");
          },
          Cancel: function() {
              $(this).dialog("close");
          }
      }
  });
  
  $("#deletec-confirm").click(function() {
      $("#deletec-box").dialog("open");
      return false;
  });
  </code></pre>
  
  <p>Here is the original link:</p>
  
  <pre><code>&lt;a href="?action=delc&amp;cid=2" id="deletec-confirm"&gt;Delete&lt;/a&gt;
  </code></pre>
  
  <p>But I have multiple links on one page with the same id. So I changed the link to:</p>
  
  <pre><code>&lt;a href="?action=delc&amp;cid=2" id="deletec-confirm10"&gt;Delete&lt;/a&gt;
  &lt;a href="?action=delc&amp;cid=2" id="deletec-confirm9"&gt;Delete&lt;/a&gt;
  &lt;a href="?action=delc&amp;cid=2" id="deletec-confirm12"&gt;Delete&lt;/a&gt;
  </code></pre>
  
  <p>How would I dynamically get the link the person clicked on to get the dialog? Right now it gets the url like so:</p>
  
  <pre><code>window.location = $('#deletec-confirm').attr('href');
  </code></pre>
  
  <p>Do I change the id to a class in the link? Or is there another way to dynamically select the id of the link so I can keep the id= attribute for each link?</p>
  
  <p>Side note, if this is considered duplicate please let me know what I need to do.</p>