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

    Keywords

    none

    Install

    npm i select-text

    DownloadsWeekly Downloads

    6

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • avatar