我想在同一台服务器上运行两个不同的Meteor应用程序(在不同的端口上),但我想在Meteor的核心软件包中改变一些东西,我希望一个应用程序使用原始软件包而另一个应用程序使用修改后的软件包.我怎么能这样做?
我想获取具有特定 id 的特定元素的属性值。对于一个例子,我想要得到的href了的a,其标签id是未来:
<a href="?page=3" id="next">Next</a>
Run Code Online (Sandbox Code Playgroud)
我知道我可以这样得到它:
console.log(document.evaluate('//a[@id="next"]', document, null, XPathResult.ANY_TYPE, null).iterateNext().href);
Run Code Online (Sandbox Code Playgroud)
但问题是,在我的情况下,属性的名称可能不同,我需要一种通过 xpath 查询来指定它的方法。像这样的东西:
'//a[@id="next"]/@href'
Run Code Online (Sandbox Code Playgroud)