How do I disable the onclick event

我们两清 提交于 2019-12-04 16:58:04

You need to prevent the event from bubbling upwards.. most simple way:

<div onclick="event.cancelBubble = true;">Booked</div>

Tested successfully for IE8, Chrome and Firefox.

you should overwrite the onclick with a function that returns false (as in: "the click is consumed"). So you'd do something like

 onclick="return false;"

wait. i meant false :)

Personally, I think you would be best served to take the 'onclick' off of the TD and place it on the div within it(similar to how you have booked). Then you can decide in your PHP logic whether to put an 'onclick' on the div or leave it off(you wouldn't need to try to override it then).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!