0

I have a select element that looks like this:

var select = <select class="form-control" id="state-dropdown" selected="Illinois"></select>

I need to be able to access the 'selected' value but I'm not sure how this is done. I've tried select.selected, select[selected], select:selected

Linx
  • 753
  • 3
  • 15
  • 34
  • 1
    Possible duplicate of [Get selected value in dropdown list using JavaScript?](http://stackoverflow.com/questions/1085801/get-selected-value-in-dropdown-list-using-javascript) – Jonathan Dion Apr 19 '17 at 16:46

1 Answers1

1

You can access any attributes on an element using element.attributes[attribute_key]

https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes

Joshua J Wilborn
  • 526
  • 3
  • 13