What is the proper way to get the value of a React element" and "W3C compatible browser" but can't find the guidelines. Trying to figure out how to avoid making the same mistake in the future :). – YPCrumble Jun 16 '15 at 16:03

  • 1
    [W3C](http://www.w3.org/) is the organization which creates the standards for web technologies, such as [CSS](http://www.w3.org/Style/CSS/Overview.en.html), [HTML](http://www.w3.org/html/) or [DOM](http://www.w3.org/DOM/). W3C compatible just means that the browser fully implements the standard (notably, older IE versions do not, but React takes care of that). – Felix Kling Jun 16 '15 at 16:05
  • 1

    While the other answer works just fine, if you're looking for a React way, then this can be accomplished by using refs.

    Assign a ref to the select:

    <select onChange={this._parseEvent} ref="select">
        <option value="----">----</option>
        <option value="Yes">Yes</option>
        <option value="No">No</option>
    /select>
    

    Get the DOM node via ref:

    var node = React.findDOMNode(this.refs.select)
    

    Get the value via DOM node:

    var value = node.value;
    

    Here's an updated fiddle to demonstrate: https://jsfiddle.net/ve88383c/4/

    Michael Parker
    • 12,724
    • 5
    • 37
    • 58
    • I wouldn't call refs on inputs the react way. – Brigand Jun 16 '15 at 17:51
    • @FakeRainBrigand There are many ways to do it using the utilities provided by React. Refs is just one of those ways. While perhaps it is not **the** react way, it is **a** react way. I updated my answer with that grammar change. – Michael Parker Jun 16 '15 at 18:05