html4-id
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/html4-id package

1.0.0 • Public • Published

html4-id

npm Downloads Node.js Version Build Status Coverage Status bitHound Dependencies bitHound Dev Dependencies bitHound Code

Create a valid HTML4 ID from an input value.

Install

NPM

$ npm install html4-id

Node.js

var idify = require('html4-id');
 
idify('This is a test!'); // Returns "this-is-a-test"

Browser

<script src="node_modules/html4-id/dist/html4-id.min.js"></script>
 
<div id="{{idify('This is a test!'}}"></div> <!-- Has the ID "this-is-a-test" -->

idify(string)

Removes invalid characters and generates an id meant to be used for HTML elements. See MDN for the note about invalid characters.

License

MIT

Dependencies (0)

    Dev Dependencies (14)

    Package Sidebar

    Install

    npm i html4-id

    Weekly Downloads

    7,780

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • davidtpate
    • tylerdixon