62,017
社区成员
发帖
与我相关
我的任务
分享
<a href="page1">
var url = window.location;
var element = $('ul.nav a').filter(function () {
return this.href == url || url.href.indexOf(this.href) == 0; // this.href返回的链接会多一个#号,比如 window.location是
// http://localhost/page1,但是this.href返回的是http://localhost/page1#
});