Home
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"> </script> <script> $(document).ready(function () { $('div').click(function (event) { alert( event.target.tagName + ' clicked'); }); }); </script> <style> div{ width:200px; height:100px; background-color:yellow } p{ width:100px; height:50px; background-color:blue; } span{ width:75px; height:30px; background-color:red; } </style> </head> <body> <h1>Demo: Event Bubbling </h1> <div> <p> <span>This is span.</span> This is p. </p> This is div. </div> <h3>Click on div,p or span. </h3> </body> </html>
Result: