select-text

1.0.1 • Public • Published

Simple script to select text in document, just pass it dom element

Usage

npm install select-text

Plain Javascript

document.onclick = function(e) {
    if (e.target.className === 'click') {
        selectText('selectme');
    }
};
<div id="selectme"><p>Some text goes here!</p><p>Moar text!</p></div>
<p class="click">Click me!</p>

With React

<div
    onClick={(e) => {
        selectText()
    }}
>
    Select Me!
</div>

Credits

Taken from http://stackoverflow.com/a/987376

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    16
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    16
  • 1.0.0
    0

Package Sidebar

Install

npm i select-text

Weekly Downloads

16

Version

1.0.1

License

MIT

Last publish

Collaborators

  • gorangajic