npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

get-anchor

1.0.1

@yoshuawuyts

npmHomeRepoSnykSocket
Downloads:4
$ npm install get-anchor
DailyWeeklyMonthlyYearly

get-anchor

NPM version build status Test coverage Downloads js-standard-style

Get an anchor by href and optional query.

Installation

$ npm install get-anchor

Usage

const getAnchor = require('get-anchor')

// create an anchor on the DOM
const anchorEl = document.createElement('a')
anchorEl.setAttribute('href', '#oh-my-element')
document.body.appendChild(anchorEl)

getAnchor('oh-my-element')
// => <a href="#oh-my-element"></a>

API

getAnchor(href [, query])

Get an anchor by href and optional query. Returns the first match.

See Also

  • scroll-to-element

License

MIT