jQuery how to get the class or id of last clicked element?
<p>I am trying to get the class or an id of the last clicked element. This is what I have based off of what I found <a href="http://stackoverflow.com/questions/5905014/determine-last-item-clicked">here</a>...</p>

<p><strong>HTML</strong></p>

<pre><code>&lt;a href="" class="button"&gt;Button&lt;/a&gt;
</code></pre>

<p><strong>JQUERY</strong></p>

<pre><code>$('.button').click(function () {
          myFuntion();
});

function myFunction (e) {
 e = e || event;
 $.lastClicked = e.target || e.srcElement;

 var lastClickedElement = $.lastClicked;
 console.log(lastClickedElement);

}
</code></pre>

<p>This sort of does what I want, but I am not sure how to go about modifying it so I can get just the class.</p>

<p>I have also tried using <a href="http://stackoverflow.com/questions/9486936/get-the-id-of-the-last-clicked-jquery">this</a> solution but couldn't get it to work with my code.</p>

<pre><code>$('.button').click(function () {
  myFuntion();
});


function myFunction(){
    var lastID;
    lastID = $(this).attr("id");

    console.log(lastID);
}
</code></pre>

<p>When I do this my console log comes back as undefined. I am probably missing something obvious. Any help is much appreciated. Thanks.</p>
