码迷,mamicode.com
首页 > Web开发 > 详细

js事件 event.target

时间:2016-09-13 11:32:45      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:

我们购物车里,会时不时增加和删除产品时,就会绑定事件和解绑的动作。

<ul>

  <li></li>

  <li></li>

</ul>

例子:在li上未来绑定事件,

$(‘ul‘).on(‘click‘,‘li‘,function(){

  $(this).remove();

});

 

例子:在ul上绑定事件

$(‘ul‘).on(‘click‘,function(event){

  var This=event.target;

  $(This).remove();

})

js事件 event.target

标签:

原文地址:http://www.cnblogs.com/love-sea520/p/5867677.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!