Created
February 21, 2014 06:30
-
-
Save xarimanx/9129767 to your computer and use it in GitHub Desktop.
find by xpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$.xpath = function(exp, ctxt) { | |
var item, coll = [], | |
result = document.evaluate(exp, ctxt || document, null, 5, null); | |
while (item = result.iterateNext()) | |
coll.push(item); | |
return $(coll); | |
} | |
})(jQuery); | |
$.xpath("//a[@href='#']").click(function () { return false; }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
5 == XPathResult.ORDERED_NODE_ITERATOR_TYPE