2
如何使这项工作:如何使鼠标事件仅适用于外部DIV?
<div onclick="alert('You clicked me!')" style="background:lightblue;display:inline-block;padding:20px">
<textarea rows="5" cols="50">You can click and select text here normally, but I don't register mouse events from the DIV behind me!</textarea>
<div id="inner" style="background:lightgreen">Same here. I want my own mouse events - not the ones from #inner.</div>
</div>
谢谢!
您需要检查事件的来源。 – nhahtdh 2012-07-29 18:33:00
你如何检查事件的来源?这可以内联完成吗(即使不推荐)?有没有办法简单地告诉一个元素不是来自其父项的固有事件? – user353885 2012-07-29 18:48:35
TEXTAREA不会在DIV后面注册鼠标事件?那是什么意思? #inner DIV需要自己的鼠标事件 - 不是来自#inner的事件?那是什么意思?在你的问题中提供更多信息。 – 2012-07-29 18:48:50