Skip to content

Commit

Permalink
Replace onchange with EventListener method (#773)
Browse files Browse the repository at this point in the history
The MDN example that redirects to this code uses EventListener method to
detect change in select element. I learned that standard practice is
using EventListener method, hence the change.
  • Loading branch information
bhagyeshsp authored Oct 28, 2024
1 parent 15fc319 commit 549fb2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion javascript/building-blocks/simple-else-if.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
const select = document.querySelector('select');
const para = document.querySelector('p');

select.onchange = setWeather;
select.addEventListener("change", setWeather);

function setWeather() {
const choice = select.value;
Expand Down

0 comments on commit 549fb2a

Please sign in to comment.