Access target property of select box


#1

hi guys

Can anyone guide me on how can i access the target properties value field in an select box onchange event?


#2

hello

<select onchange={{action 'yourFunction' value='target.value'}}>
  <option value=1>option 1</option>
  <option value=2>option 2</option>
</select>

Ember Twiddle: link

You can also set the option value as an Ember object:

<option value={{yourObject}}>some text</option>

to preselect an option you need to set “selected=true” on the option element:

<option selected=true>some text</option>

#3

thanks :slight_smile: