标签:jquery span his click char cli bsp pre meta
1
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div class=‘c1‘> <div> <div class=‘title‘>菜单一</div> <div class=‘content‘>内容 一</div> </div> <div> <div class=‘title‘>菜单一</div> <div class=‘content‘>内容 一</div> </div> <div> <div class=‘title‘>菜单一</div> <div class=‘content‘>内容 一</div> </div> <div> <div class=‘title‘>菜单一</div> <div class=‘content‘>内容 一</div> </div> </div> <script src="jquery-1.12.4%20(1).js"></script> <script> $(".title").click(function () { console.log($(this).text(),‘1‘) }) $(".title").bind(‘click‘,function () { console.log($(this).text(),‘2‘) }) //委托 $(".c1").delegate(‘.title‘,‘click‘,function () { console.log($(this).text(),‘3‘) }) $(‘.c1‘).on(‘click‘,‘.title‘,function () { console.log($(this).text(),‘4‘) }) </script> </body> </html>
标签:jquery span his click char cli bsp pre meta
原文地址:http://www.cnblogs.com/liruixin/p/6504858.html