Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phrozenbyte/jquery-xpath
Determine the XPath of an element with jQuery
https://github.com/phrozenbyte/jquery-xpath
javascript jquery jquery-plugin jquery-xpath xpath
Last synced: about 1 month ago
JSON representation
Determine the XPath of an element with jQuery
- Host: GitHub
- URL: https://github.com/phrozenbyte/jquery-xpath
- Owner: PhrozenByte
- License: other
- Created: 2013-08-06T23:12:22.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-08-12T21:09:57.000Z (over 11 years ago)
- Last Synced: 2024-10-07T23:40:56.708Z (4 months ago)
- Topics: javascript, jquery, jquery-plugin, jquery-xpath, xpath
- Language: JavaScript
- Size: 123 KB
- Stars: 3
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
jQuery-XPath 1.1
================
Determine the XPath of an element with jQuery.Usage
-----
Just download the sourcecode, upload the file to your webspace and load it. Obviously [jQuery](http://jquery.com/) is required.
```html```
To get the XPath of an element simply call ```.xpath()```. Please note that only the first element in jQuerys list of matched elements is considered. If the given element has an ```id``` attribute, the XPath plugin will use it.
```javascript
$('form input[type=email]').xpath();
// Returns: //*[@id="email"]
```
If you don't want the ```id``` attribute to be considered, pass ```true``` as the first parameter.
```javascript
$('form input[type=email]').xpath(true);
// Returns: /html/body/section/form/div[2]/div/input
```Copyright & License
-------------------
The functionality of jQuery-XPath is pretty much an abstract of [Firebug](https://getfirebug.com/)s [extension/content/firebug/lib/xpath.js](https://github.com/firebug/firebug/blob/firebug-1.11.1/extension/content/firebug/lib/xpath.js) (Version 1.11.1). Copyright remains by the [Mozilla Foundation](https://www.mozilla.org/en-US/foundation/). Accordingly this plugin is licensed under 3-clause BSD. See the [LICENSE](LICENSE) file for details.