https://github.com/ashiknesin/closest-link
Find closest hyperlink in DOM element
https://github.com/ashiknesin/closest-link
dom dom-element dom-utilities hyperlink javascript
Last synced: 11 months ago
JSON representation
Find closest hyperlink in DOM element
- Host: GitHub
- URL: https://github.com/ashiknesin/closest-link
- Owner: AshikNesin
- License: mit
- Created: 2017-06-12T07:53:34.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-12T10:03:19.000Z (about 9 years ago)
- Last Synced: 2025-07-01T10:54:35.803Z (12 months ago)
- Topics: dom, dom-element, dom-utilities, hyperlink, javascript
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/closest-link
- Size: 2.93 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
> Find closest hyperlink in DOM element
## Install
```
$ npm install --save closest-link
```
## Usage
```html
Here is link
Here is outer-span
Here is inner-span
```
```js
const closestLink = require('closest-link');
const targetElement = document.querySelector('#inner-span')
closestLink(targetElement);
//=> '...'
```
## License
MIT © [Ashik Nesin](https://ashiknesin.com)