meteor - Why does my select element have an empty item at the beginning? -
i've got empty first item in select element:
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
Post a Comment