我有下面的页面工作得很好(我已经删除了一些其他字段和样式,以保持我在这里发布的样本不多)。我希望表中的Premium行(第17行)格式化为货币(USD)。这样做的最好方法是什么?Knockout/JQuery货币格式
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="datagrid" >
<table >
<thead>
<tr>
<th>Location Name</th>
<th>Location Total</th>
</tr>
</thead>
<tbody data-bind="foreach: { data: Locations, as: 'location' }">
<tr>
<td><span data-bind="text: location.LocationName" /> </td>
<td><span data-bind="text: location.Premium" /> </td>
</tr>
</tbody>
</table>
</div>
<script>
$(document).ready(function()
{
var appViewModel
// AppViewModel
function AppViewModel()
{
this.Locations = ko.observable([]);
}
var appViewModel = new AppViewModel();
ko.applyBindings(appViewModel);
$.getJSON("http://waltweb01:85/LTCEPLWS/LTCJSON.svc/getLTCWithIDs/4", function (data)
{
incomingData = data;
appViewModel.Locations(data.getLTCWithIDsResult.Locations);
});
});
</script>
</asp:Content>
复制http://stackoverflow.com/questions/5807155/jquery-currency-格式编号 – Charles380
不重复。坦率地说,我看不出连接的被指控程序的13票答案如何适用于该页面的原始问题。 –
无论如何...我已经使用“