javascript - Polymer 1.0 reading select value when there is an inside template(dom-repeat) in select tag -
i'm having trouble polymer 1.0 element. have print inside select every option of book size (a5, a4) , prices every selection(this information js array returned _returnselitemdataarr).
array data looks this:
_returnselitemdataarr: [array[id, name, extra], array[id, name, extra]].
here bit of source code :
<select id="sizeselect" value="{{itm.id::change}}" aria-labelledby="sizelabel"> <template is="dom-repeat" items="{{_returnselitemdataarr(item, 'sizes')}}" as="itm"> <option value="{{index}}" selected$="[[_computeselected(index, itm)]]">{{itm.name}} (+{{itm.extra}} lei)</option> </template> </select> select compute function: _computeselected: function(index, itm) { return index+1===parseint(itm.id, 10); },
problem when try selection value "#sizeselect" code : this.$.sizeselect.value
console output of select value undefined
. accesing select value seems problem when using polymer dom-repeat options. happens know how access select value ? note: have mention 'item' product, it's object contains information product
answer:
select element id under shadow-dom have use operator $$
. me this: this.$$('#sizeselect').value
.
answer: select element id under shadow-dom have use operator $$
. me this: this.$$('#sizeselect').value
.
Comments
Post a Comment