How to access HTML element using XPath in IE8?

后端 未结 3 830
鱼传尺愫
鱼传尺愫 2020-12-21 09:00

I am stuck with as issue of accessing HTML element in IE using XPath in Javascript? I already tried with selectNodes() method but its for XML only, it does not work for XPat

相关标签:
3条回答
  • 2020-12-21 09:24

    Try Wicked Good XPath: https://code.google.com/p/wicked-good-xpath/

    It is the smallest and fastest JavaScript-based XPath library and maintained by Google.

    0 讨论(0)
  • 2020-12-21 09:34

    you can try the following ,

    Browsers can use the following to get all elements with a given tag, regardless of namespace, if the document is served as application/xhtml+xml or other XML type:

        var titles = document.getElementsByTagNameNS("*","input[@name='action']");  
    
    0 讨论(0)
  • 2020-12-21 09:47

    You might also like this solution to add xpath support for HTML in IE:

    http://sourceforge.net/projects/html-xpath/

    This has the benefit of unifying the API between IE and other browsers, as well.

    0 讨论(0)
提交回复
热议问题