JavaScript Function to get Target From Event

Quick one today:

When you’re looking for the target from an event. It’s a good idea to do the following:

function stuff(e) {

    var target = || e.srcElement;


For older IE browsers don’t have “.target” and instead have “srcElement”

Leave a Reply

Your email address will not be published. Required fields are marked *