每次在js代码里面想动态的拼个dom,然后append到页面上,都是各种麻烦,
要是可以直接在jsp页面弄个隐藏的model那是很好的,用js方法里面的clone方法也是很好的,还可以给不同部分set值。
为了以后简单点,我就把模板摆着,方便后面用得着的时候,复制粘贴。
function fillDialog(dataArray) { var target = $("#dialogTarget"); target.empty(); for (var i = 0; i'); label.text("" + dataArray[i].channelName); var input = $(""); input.prop("name", "checkbox"); input.prop("type", "checkbox"); input.prop("value", dataArray[i].id); if (dataArray[i].showInUserStatistic) { input.prop("checked", "true"); } label.prepend(input); target.append(label); } }
var trs = ""; for (var i = 0; i0) { //去分行活跃用户数的小数部分如:11.0 ---> 11 activeUser = activeUser.substring(0, index); } trs += " "; } newList.append("" + trs + ""); tableChart.append(newList.show()); " + branchBank + " "; trs += "" + newUser + " "; trs += "" + netBoostUser + " "; trs += "" + closeUser + " "; trs += "" + activeUser + " "; trs += "
var $metric = $("#metric"); $metric.empty(); var optGroup0 = $("
function fillRecoveryTable(data) { var $tableBody = $("#recoveryTable").find("tbody"); $tableBody.empty(); var trs = ""; for (var i = 0; i" + recovery.fileName + " "; trs += "" + recovery.timeString + " "; trs += "" + (recovery.result ? "成功" : "失败") + " "; trs += "" + "" + " "; trs += ""; } $tableBody.append(trs); }
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接