这是我的div部分 -
<div data-role="content" class="school">
</div>
这是我的main.js
$(function () {
var context = {school: "<div data-role='page'>"
"<ul data-role='listview' id='unorderedList'>"
"<li><a href='nl.html' data-icon='grid'>News Letter</a></li>"
"<li><a href='school.html' data-icon='star' >School News</a></li>"
"<li><a href='settings.html' data-icon='gear'>Settings</a></li>"
"</ul>"
"</div>"}
var html = template(context);
});
答案 0 :(得分:0)
试试这个
$(function () {
var context = "<div data-role='page'>\
<ul data-role='listview' id='unorderedList'>\
<li><a href='nl.html' data-icon='grid'>News Letter</a></li>\
<li><a href='school.html' data-icon='star' >School News</a></li>\
<li><a href='settings.html' data-icon='gear'>Settings</a></li>\
</ul>\
</div>"
$('.school').html(context);
});