简体   繁体   中英

How to check if a div have a onclick event using JavaScript

Does anyone know how to check if a div have a onCick event let say i have a div

<div id="test" onClick={function123()}>
{childeren}
</div>
<div id="test">
{childeren}
</div>

so how to check if which div have onClick event?

a solution for this query so that i can ignore element that has onClick events

below is the solution nodeName.onclick === "function"

if above solution is true that means div has onClick else it will be false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM