I was under the impression that I could get the value of a select input by doing this $(this).val();
and applying the onchange
parameter to the select field.
It would appear it only works if I reference the ID.
How do I do it using this.
I was under the impression that I could get the value of a select input by doing this $(this).val();
and applying the onchange
parameter to the select field.
It would appear it only works if I reference the ID.
How do I do it using this.
I want to add, who needs full custom header functionality
Try the event delegation method, this works in almost all cases.
Try this-
You can also reference with onchange event-
This is what worked for me. Tried everything else with no luck:
Taken from Mozilla
Arrow function has a different scope than function,
this.value
will give undefined for an arrow function. To fix useThis works if you subscribe unobtrusively (which is the recommended approach):
if you use
onselect
and mix markup with script you need to pass a reference to the current element:and then: