哎, 看看这个代码:我是谁或我如何知道我正在处理的元素?
$("li,p").click(function(){
// how do I perform a test, and know wich Element it is ?
if(/* I'm a <li/> */)
// Do this for the <li/>
if(/* I'm a <p/> */)
// Do this for the <p/>
})
谢谢你们^^
为何使用相同的处理程序里和P,如果你需要为每个做不同的事情? – Belinda 2011-03-21 14:01:12
我有相同的指令(很多实际)来执行他们两个。但其他人有一些差异 – 2011-03-21 14:04:28