HTML event handler attributes: down the rabbit hole (via) onclick="myfunction(event)"
is an idiom for passing the click event to a function - but how does it work? It turns out the answer is buried deep in the HTML spec - the browser wraps that string of code in a function(event) { ... that string ... }
function and makes the event available to its local scope that way.
Recent articles
- Gemini 2.5 Computer Use can solve Google's own CAPTCHAs - 7th October 2025
- Vibe engineering - 7th October 2025
- OpenAI DevDay 2025 live blog - 6th October 2025