meteor - Why does my select element have an empty item at the beginning? -


i've got empty first item in select element:

enter image description here

i don't know why; here's html/spacebars in meteor app:

<select id="stateorprovince" name="stateorprovince">     <option selected="selected"></option>     {{#each statesandprovinces}}       <option title="{{hint}}">{{abbrcode}}</option>     {{/each}} </select> 

...and here's meteor helper returns values:

template.addperson.helpers({   statesandprovinces: function() {     return [{       "hint": "alabama",       "abbrcode": "al"     }, {       "hint": "alaska",       "abbrcode": "ak"     }, {     . . . 

if remove line html/spacebars:

<option selected="selected"></option> 

...i no longer have empty line after dropping down select, makes al default/displayed value prior dropdown; don't want - want blank default - yet not have empty value when dropping down.

how can 86 superfluous prepended empty item without adding abalama default value?

you need change <option selected="selected"></option> <option selected="selected" disabled hidden></option>.

this display empty option default, if users choose option won't see blank 1 nor able select it.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -