JavaScript在IE中使用Xpath查找htnlelement [英] JavaScript to find htnlelement using Xpath in IE

查看:43
本文介绍了JavaScript在IE中使用Xpath查找htnlelement的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我想用XPath获取html元素。我可以在Chrome和FireFox中使用带有以下代码的XPath获取html元素,但不能在IE中获取。



  return   document  .evaluate(\   // input \,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue  





如何在Javascript中使用Xpath获取html元素。



问候,

Rajendar。

解决方案< IE中不支持/div>

document.evaluate(最高为IE 10,不确定为11)。使用jQuery,Sizzle或其他一些库。



这个 [ ^ ]仅适用于IE,如果您愿意的话折磨自己:)





如果这有帮助请花时间接受解决方案。谢谢。


Hi Everyone,

I want get html element using XPath. I can able get html element using XPath with below code in Chrome and FireFox but not in IE.

return document.evaluate(\"//input\", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue



How can I get html element using Xpath in Javascript.

Regards,
Rajendar.

解决方案

document.evaluate is not supported in IE (up to IE 10, not sure about 11). Use jQuery, Sizzle or some other library.

there is this[^] for IE only if you're willing to torture your self :)


If this helps please take time to accept the solution. Thank you.


这篇关于JavaScript在IE中使用Xpath查找htnlelement的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆