我目前正在使用以下代码来定位各个页面,例如http://my-website.com/about/
if (document.location.pathname == "/about/") { //Code goes here }
我想知道如何对具有某个父页面的所有页面执行相同的操作,例如/about/以下示例.
/about/
http://my-website.com/about/child-page1
http://my-website.com/about/child-page2
url jquery pathname
jquery ×1
pathname ×1
url ×1