DEV Community

Discussion on: How to do wiring in VanillaJS

Collapse
 
ptejada profile image
Pablo Tejada • Edited

This would be the original wiring :)

<script>
function clickEventHandler() {
   alert('Clicked')
}
</script>

<button onclick="clickEventHandler()">Click</button>
Enter fullscreen mode Exit fullscreen mode
Collapse
 
tarandeep_singh profile image
Tarandeep Singh

Thanks for sharing Pablo 😄

Collapse
 
artydev profile image
artydev • Edited

The problem, with this approach, it is that 'clickEventHandler' is attached to the Window object.

Collapse
 
ptejada profile image
Pablo Tejada

Is a peace of history 😀