Get articleID from ID of recently clicked link
<p>I have this:</p>

<pre><code>&lt;a href="#" id="article-2341234" class="article-link"&gt;click to see article&lt;/a&gt;
&lt;div id="article-body-2341234" style="display:none;"&gt; ...
...
...
&lt;/div&gt;
</code></pre>

<p>Now I want to do this:</p>

<ol>
<li>prevent default </li>
<li>get articleid '2341234' from the id of the link just clicked</li>
<li>hide the link and display the article below it</li>
</ol>

<p><strong>I also want to capture the recently clicked link in a variable as I will refer to it many times in the click event and I want to be effecient.</strong></p>

<p>I have this so far:</p>

<pre><code>$(".article-link").bind("click", function(e) {

e.preventDefault();
var articleId = ?????;

$("#article-link-" + articleId).hide();
$("#article-body-" + articleId).show();


});
</code></pre>

<p>I need a generic function that will get the 'articleid' from the ID of the element, how can I do this?</p>

<p>How can I store the recently clicked link in a variable so I can refer to it again.  Is it:</p>

<p><code>$(this)</code>  ?</p>
