简体   繁体   中英

How to detect mouse click on element inside WordPress Visual Editor

How to detect click on element inside WordPress Visual Editor using javascript?

在此处输入图片说明

<span class="blue-button" onclick="myFunction()">Click</span>

<script>
function myFunction(){
 alert("Clicked")
}
</script>

I'm not sure if this answer will help you, but for all click tracking on my website i use Google tag manager integrated with Google analytics. If you are open to considering this route i can link some videos that could help you

Solution below :

 jQuery(document).on('tinymce-editor-init', function(event, editor) { editor.on('click', function(e) { e = e.target; alert(e.nodeName); }); }); 

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