html4-id
Create a valid HTML4 ID from an input value.
Install
NPM
$ npm install html4-id
Node.js
var idify = ; ; // Returns "this-is-a-test"
Browser
<!-- 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.