title: How can I combine these three blocks of code in jQuery and write them more elegantly/efficiently?
body: <p>I have the following three blocks of code and was wondering if I could somehow combine them so I don't have to keep writing the same code over and over again. Sorry if I'm explaining this funny. I just want to learn to write as elegantly/efficiently as I can.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;a href="#" id="download-1"&gt;Tweet to Download&lt;/a&gt;&lt;/li&gt;
  &lt;a href="#" class="download1"&gt;Download&lt;/a&gt;&lt;/li&gt;
  
  &lt;a href="#" id="download-2"&gt;Tweet to Download&lt;/a&gt;&lt;/li&gt;
  &lt;a href="#" class="download2"&gt;Download&lt;/a&gt;&lt;/li&gt;
  
  &lt;a href="#" id="download-3"&gt;Tweet to Download&lt;/a&gt;&lt;/li&gt;
  &lt;a href="#" class="download3"&gt;Download&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <h1>1</h1>
  
  <pre><code>  // Download 1
    $('#download-1').tweetAction({
      url: 'download1',
      text: 'Download 1',
      via: 'twittersn'
    },function(){
      // When the user closes the pop-up window:
  
      $('a.download1')
        .addClass('active')
        .attr('href','download1.psd');
    });
  </code></pre>
  
  <h1>2</h1>
  
  <pre><code>  // Download 2
    $('#download2').tweetAction({
      url: 'download2',
      text: 'Download 2',
      via: 'twittersn'
    },function(){
      // When the user closes the pop-up window:
  
      $('a.download2')
        .addClass('active')
        .attr('href','download2.psd');
    });
  </code></pre>
  
  <h1>3</h1>
  
  <pre><code>  // Download 3
    $('#download3').tweetAction({
      url: 'download3',
      text: 'Download 3',
      via: 'twittersn'
    },function(){
      // When the user closes the pop-up window:
  
      $('a.download3')
        .addClass('active')
        .attr('href','download3.psd');
    });
  </code></pre>