0

I am trying to construct a select using mustache.js

here's the code: template:

<select id="hostTechCd" ref="techCd">
     {{#techCd}}
         <option value={{value}}> {{text}}</option>
     {{/techCd}}
</select>

data:

{
    techCd:[{
             value:"JAVA",
             text:"java"
            },
            {
             value:"JAVA SCRIPT",
             text:"java script"
            },
            {
             value:"HADOOP",
             text:"hadoop"
            },
            {
             value:"PERL SCRIPT",
             text:"perl script"
            }]
}

everything seems fine but the rendered select box is not proper. The value attributes of options for "Java Script" and "Perl Script" are broken.

here is the output html of the above code:

<select id="hostTechCd" ref="techCd">
     <option value="JAVA"> java</option>
     <option value="JAVA" script=""> java script</option>
     <option value="HADOOP"> hadoop</option>
     <option value="PERL" script=""> perl script</option>
</select>

any help guys ???

4

1 回答 1

0

更改<option value={{value}}> {{text}}</option><option value="{{value}}"> {{text}}</option>

于 2013-10-24T16:52:34.803 回答