I'm trying to get the innerHTML/Text from the select options from a dropdownlist instead of the value.
var Array = []; $('#select option').each(function(){Array.push(this.value)});
The method above works, but it only stores the value attribute of the options.
For example, if my option were to be <option value="John">Hello</option>, It would store John instead of Hello. I want it to store whatever's in the innerHTML of the option. How do I go about doing this? .innerHTML() before the .each() doesn't work.
Arrayto something else.Arrayis the name of the javascript class for all primitive arrays(Ref. developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…). I feel like naming your variable as such is a quick way to lead into unexpected errors.