Jquery加载多个模板页面
Jquery load multiple template pages
我有一个问题与jQuery当我试图加载几个一个模板页面内的div
。我试图用jQuery选择器替换模板中的数据。我需要使用jQuery选择器让currency()
工作。只保留最后插入的数据
代码如下:
HTML:<div id="loanPH"></div>
Javascript: //This iterate through the banks to a person that can be several which
//becomes the issue
$.each(person.bank, function(index, element) {
$('#loanPH').append($("<div>").load('/Templates/MinSide/loanView.html', null, function() {
//To be able to use currency it got to be a jQuery object and
//not a simple string that I could have appended
$('#total').html(element.total).currency();
$('#rate').html(element.rate).currency();
$('#bankName').html(element.bankName);
}));
});
模板loanView.html: Total: <span id="total"></span><br/>
Rate: <span id="rate"></span><br/>
Bank: <span id="bankName"></span><br/>
使用click event for one template upload
window.jQuery.click(person.bank, function (index, element) { $('#loanPH').load('/Templates/loanView.html', null, function () { //To be able to use currency it got to be a jQuery object and //not a simple string that I could have appended $('#total').html(element.total).currency(); $('#rate').html(element.rate).currency(); $('#bankName').html(element.bankName); }); });
相关文章:
- 使用javascript函数在页面初始化后加载jquery
- 什么'这是加载jQuery的最佳方式
- 在WordPress站点中加载jquery.js后加载javascript代码
- 延迟加载jquery后替换$(document).ready(function)
- 如何使用onLoad加载jQuery JSON.从Zipcode On Form获取城市和州
- 对页面重新加载 Jquery 执行操作
- 在Ajax(过滤器)加载之后加载jQuery脚本
- 异步加载JQuery时Tabbed Box已损坏
- 加载Jquery时Chrome扩展出错
- 在更改事件上加载jQuery DataTable
- 手动加载JQuery而不触发内容安全策略
- 如果更改,请在ng之后重新加载Jquery
- 脚本似乎在加载jQuery之前运行-未定义Uncaught ReferenceError:$
- 在使用jquery之前动态加载jquery
- 如何重新加载jquery,以便它能为下一个进程工作
- Firefox没有't从ajax.googleapis.com加载jquery
- 我无法在自定义Wordpress主题中成功加载jQuery
- 正在从maphilight href加载Jquery选项卡
- 如何在完全加载html之后加载jquery代码段
- 在页面加载jQuery/Javascript时,按.class对表行进行排序