Friday 5 May 2017

Getting the selected option in Javascript/Node.js

Self teaching Node.js and Javascript stuff. I have in the form in my HTML and select, drop down menu option. How do I get the index of the selected value?

So far im trying this:

var e = req.body.boolean_choice;
boolChoice = e.selectedIndex;

I have the req.body working for getting the inputted values in a text box, but it tells me selectedIndex is not a thing. So then I tried:

var e = req.body.boolean_choice

to see what that gave and it just gave undefined.

Is there a way to do this?



via Dominic Reeve

No comments:

Post a Comment