jquery on event
Posted rojas
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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>
以上是关于jquery on event的主要内容,如果未能解决你的问题,请参考以下文章
jquery bind event, use on. $(document).on("click","#a",function(){alert}) [#d(代码
event.preventDefault() 不适用于 jQuery 移动设备?
jQuery: $(document).on(event, name as selector, function [重复]