KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
If I want a function to be executed, I prefer doing inline js: <p id="element" onclick="doSomething();">Click me</p> because it is easier to debug. However, I hear people saying not to use inline js, and do: document.getElementById('element').onclick = doSomething; Why is the js event listener recommended?
Tags (comma-separated)
Save Edits
Cancel