I'm brand new to Javascript and trying to attach an event handler to a select list. Here is my html:
<select id="x_selector"></select>
to which I'm adding a bunch of option entries successfully. However I want to add an on change method. This jquery javascript works:
let xsel = $("#x_selector");
xsel.on("change", event => {console.log(event)});
But this doesn't:
var xSelector = document.getElementById('x_selector');
xSelector.on("change", event => {console.log(event)});
With the latter one I get a console TypeError: xSelector.on is not a function.
So what is the difference between document.getElementById and the jquery selector?