我正在使用 Html5 和 jquery 开发一个 Web 应用程序。Error: Syntax error, unrecognized expression: #chapter?book=Exod&num=1
当我尝试从当前页面导航到另一个页面时出现此“ ”错误<div data-role="page" id="chapter">
我的代码:
$(document).ready(function() {
for (var x in books) {
if (x.indexOf('_')>=0) {
var items = '<li><a href="#chapter?book='+ x.substring(1) +'&num=1">'+ books[x].bname +'</a></li>';
}
$("#book_list").append(items);
}
$('#book_list').find(':jqmData(role=listview)').listview();
});
// Listen for pagebeforechange event
$(document).bind( "pagebeforechange", function( data ) {
// only handle changePage() when loading a page by URL.
if ( typeof data.toPage === "string" ) {
// Handle URLs that requests chapter page
var url = $.mobile.path.parseUrl( data.toPage ), regex = /^#chapter/;
if ( url.hash.search(regex) !== -1 ) {
showChapter( url, data.options );
// tell changePage() we've handled this
//e.preventDefault();
}
}
});
提前致谢。