(edge) and delegate events and firebug lite

by Hari Menon

HTML

<button>Attach firsty-first handler</button>
<div>
   <p>This is the para</p>
   <table>
       <tbody>
           <tr><td>whip</td><td>it</td></tr>
           <tr><td>into</td><td>shape</td></tr>
       </tbody>
   </table>
</div>

CSS

td { width: 2em; border: 1px solid #888; }

JavaScript

$("div").on("click", function(e){
    console.log("clicked on "+e.target.nodeName+": "+$(e.target).text());
});

$("button").on("click", function(){
    $("div").on("click", "*", function(e){
        console.log("HAHA sucker, caught click on "+e.target.nodeName+": "+$(e.target).text());
        e.stopImmediatePropagation()
    });
});