<!DOCTYPE html> <html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> </head> <body> <ul> <li>list <strong>item 1</strong></li> <li><span>list item 2</span></li> <li>list item 3</li> </ul> <script> $("ul").click(function(event) { var $target = $(event.target); if ( $target.is("li") ) { $target.css("background-color", "red"); } }); </script> </body> </html>
这里的$(event.target).is('li')是什么意思 为什么相当于 e.target.nodeName.toLowerCase()=='li'这个判断语句?
风筝_0010
慕瓜9220888
慕瓜9220888
相关分类