Call function based on dropdown selection
13,923
Simply myFunc(this.value)
, since this
== document.getElementByID("propertydropdow")
in the handler
Author by
LemonMan
Updated on June 04, 2022Comments
-
LemonMan almost 2 years
I have the following dropdown
<select onchange="myFunc(argument here)" id="propertydropdown"> <option value="tags">blah</option> <option value="tags2">blahblah</option> <option value="tags3">blahblahblah</option> </select>
how do i get the argument to be the value of the option currently selected?
-
LemonMan over 10 yearsyup that's the answer thanks!
-
LemonMan over 10 yearshow would I do this if I have <input onchange="tcUpdate(argument)" type="color" name="favcolor">
-
Bergi over 10 years@Lemonio: It's the same actually?
-
LemonMan over 10 yearsi don't think my onchange is working then, though maybe i'm just doing something else wrong
-
LemonMan over 10 yearsnvm found a workaround
-
P-RAD over 9 yearsif the text contain spaces I can only access the first word