Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #36182
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2019-03-27 00:48 -0700 |
| Message-ID | <10e6bc28-bec2-4796-81af-a4159fc0cb96@googlegroups.com> (permalink) |
| Subject | Event handler/listener syntax |
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
I find the eventhandler syntax weird "constructed" and hard to read, can you break out the actual code to to from eventhandler?
document.getElementById("try").addEventListener("click", function(){
});
instead
document.getElementById("try").addEventListener("click", dothis);
function dothis(){
document.getElementById("text").innerText = "GeeksforGeeks";
}
If not why was the former syntax chosen?
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
Event handler/listener syntax Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-03-27 00:48 -0700
Re: Event handler/listener syntax Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-03-27 00:54 -0700
Re: Event handler/listener syntax Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-03-27 00:57 -0700
Re: Event handler/listener syntax Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-03-27 01:03 -0700
csiph-web