OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How can I programmatically determine if an Event will execute JavaScript

  • Thread starter Thread starter 90ueiomtn
  • Start date Start date
9

90ueiomtn

Guest
I am trying to understand data mutations that are occurring client-side after an event is triggered, but I cannot locate the event triggering logic. Given the following page, I have created two buttons which have events bound:

Code:
<html>

<button onClick="console.log('Inline button clicked')">Inline Button</button>
<button id="x">Bound Button</button>

<script>

document.getElementById("x").addEventListener("click", (event) => { 
    console.log("JS Bound clicked")
});
</script>
</html>

I can determine what will occur when the following button is clicked with the JavaScript document.getElementsByTagName("button")[0].onclick, however this does not work for the second.

How can I determine if clicking on an element will trigger an event without clicking on the button.

As an extension, is it possible to configure a browser debugger to break on the next (significant) event, without knowing which event will be triggered?
<p>I am trying to understand data mutations that are occurring client-side after an event is triggered, but I cannot locate the event triggering logic. Given the following page, I have created two buttons which have events bound:</p>
<pre><code><html>

<button onClick="console.log('Inline button clicked')">Inline Button</button>
<button id="x">Bound Button</button>

<script>

document.getElementById("x").addEventListener("click", (event) => {
console.log("JS Bound clicked")
});
</script>
</html>
</code></pre>
<p>I can determine what will occur when the following button is clicked with the JavaScript <code>document.getElementsByTagName("button")[0].onclick</code>, however this does not work for the second.</p>
<p>How can I determine if clicking on an element will trigger an event without clicking on the button.</p>
<p>As an extension, is it possible to configure a browser debugger to break on the next (significant) event, without knowing which event will be triggered?</p>
Continue reading...
 

Latest posts

Top