Javascript – Determine which event is triggered

Recently i have been working with Dashing which is a great tool to displaying information as a dashboard. I would like to show the dashboard on a big TV. Everything works fine on my Mac but when it is shown on the TV screen, the onclick event is not triggered.

I need to check which event is triggered when i press on the TV screen. The web developer console in Chrome of Firebug in Firefox could help you to determine which event is triggered. For example, the menu bar of Eureka! has the following HTML structure.

<div class="nav-menu">
    <li class="page_item page-item-1630"><a href="">About</a></li>
    <li class="page_item page-item-8284"><a href="">Portfolio</a></li>
    <li class="page_item page-item-731"><a href="">Faz Jewelry</a></li>
    <li class="page_item page-item-6494"><a href="">Linux Commands</a></li>
    <li class="page_item page-item-8388"><a href="">Reads</a></li>
    <li class="page_item page-item-7349"><a href="">Syntax Highlight</a></li>
    <li class="page_item page-item-9773"><a href="">旅行記</a></li>


I would like to monitor all the events which are triggered by the first li.page_item element. This can be done by inputing the following command in the console.



Then you can move your mouse pointer to the first menu item and all the events being triggered are outputted to the console.

You can also filter out those events which you don’t care. Ex:

// Monitor mouseover and mouseout only
monitorEvents(document.getElementsByClassName("page_item")[0], ["mouseover", "mouseout"])


Finally, it is found that the triggered events on the TV are ontouchstart, ontouchmove and ontouchend.

Done =)

Reference: Firebug Wiki – MonitorEvents


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.