使用jquery给html标签加点击事件

//直接给所有img标签绑定click事件
$("img").click(function(){
   alert('你点击了图片');
})
  
//使用bind方法绑定click事件
$("img").bind("click",function(){
   alert('你点击了图片');
})

 

posted @ 2019-11-21 16:28  liuw_flexi  阅读(1552)  评论(0编辑  收藏  举报