title: Get ID of clicked Element in snap.svg
body: <p>What is the best (cross browser) approach to get the attribute <code>id</code> (or basically any attribute that helps me identifying the Element on which the event happened) within an event handling function (e.g. click callback function) of <strong>snap.svg</strong> <a href="http://snapsvg.io/" rel="nofollow">http://snapsvg.io/</a></p>
  
  <p>Here is some code. What I have tried seems to work in latest Chrome and FF, but I wonder if there is a better approach.</p>
  
  <pre><code>    //add an Element, set id
      var mySvg = Snap('#mySvg');
      var myRect = mySvg.rect(10,10,200,100);
      myRect.attr({id:'myId'});
  
      //register click callback
      myRect.click(clickCallback);
  
      //click callback
      var clickCallback = function(event) {
         // how do I get the id of the clicked element?
         // is this cross browser valid?
         var id = event.target.attributes.id.nodeValue;
      };
  </code></pre>