[英]Clickable div inside a button doesn't work on firefox
I have a expandable section which is a button (this is from a framework that I can not change). 我有一个可扩展部分,它是一个按钮(这是我无法更改的框架)。 And inside this section, I got a clickable div. 在此部分中,我得到了一个可点击的div。 This is working on Chrome, IE, Safari, but not on Firefox. 这适用于Chrome,IE,Safari,但不适用于Firefox。
<button onclick="alert('expand');" class="button"> <div onclick="alert('Edit');" class="edit">Edit</div><br/> </button>
https://jsfiddle.net/dLbkq6uy/1/ https://jsfiddle.net/dLbkq6uy/1/
I can't fire the click event for the DIV inside this button on Firefox. 我无法在Firefox的此按钮内触发DIV的click事件。
In Firefox, the button
itself steals events like mouse events and click of the child element. 在Firefox中, button
本身会窃取鼠标事件和子元素单击之类的事件。 This means things inside buttons cannot be clicked. 这意味着无法单击按钮内的内容。 It is not considered a bug because it works exactly as designed. 它不被认为是错误,因为它的工作原理与设计完全相同。
Based on the above links the solution for Firefox is to change the button
to some other element like div
and manage the functionality and design accordingly. 基于以上链接,Firefox的解决方案是将button
更改为其他元素(如div
并管理功能并进行相应设计。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.