<script id="dropdownTemplate" type="text/x-jquery-tmpl">
<label for="${Name.toLowerCase()}">${Name}</label>
<select name="${Name.toLowerCase()}" id="${Name.toLowerCase()}_dropdown">
<option selected='' value=''>-- Select a ${Name} --</option>
<option value="${$item.Options.Value}">${$item.Options.Choice}</option>
</select>
</script>
var provinces = {
Name: "Province",
Options: [
{ Value: "AB", Choice: "Alberta" },
{ Value: "BC", Choice: "British Columbia" },
{ Value: "MB", Choice: "Manitoba" },
{ Value: "NB", Choice: "New Brunswick" },
{ Value: "NF", Choice: "Newfoundland" },
{ Value: "NS", Choice: "Nova Scotia" },
{ Value: "NT", Choice: "Northwest Territories" },
{ Value: "NU", Choice: "Nunavut" },
{ Value: "ON", Choice: "Ontario" },
{ Value: "PE", Choice: "Prince Edward Island" },
{ Value: "QC", Choice: "Quebec" },
{ Value: "SK", Choice: "Saskatchewan" },
{ Value: "YT", Choice: "Yukon" }
]
};
// Render the template with the provinces data and insert
// the rendered HTML under the "movieList" element
$( "#dropdownTemplate" ).tmpl( provinces ).appendTo( "#movieList" );
在我的 jQuery 模板中显示Value
或的正确语法是什么?Choice