jquery on event
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>on demo</title> <style> p { background: yellow; font-weight: bold; cursor: pointer; padding: 5px; } p.over { background: #ccc; } span { color: red; } </style> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> </head> <body> <p>Click me!</p> <span></span> <table id="table1"> <tr id="tr1"> <td> c 1 </td> </tr> <tr id="tr2"> <td> c 2 </td> </tr> </table> <table id="table2"> <tr id="tr1"> <td> table 2c 1 </td> </tr> <tr id="tr2"> <td> table 2c 2 </td> </tr>y.fei </table> <script> var count = 0; $( "#table2 #tr1 td" ).on( "click", function() { $( this ).after( "<p>Another paragraph! " + (++count) + "</p>" ); }); </script> </body> </html>