Skip to content

foss-dev/copy-simple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

copy.js

copy-simple.js is a painless copy helper for JavaScript.

Usage

There are different functions to copy values. All methods will return true or false;

Install with NPM

npm i copy-simple

Import copy-simple

import copy from 'copy-simple';

Copy Element Value - val()

<input id="testVal" type="text" value="Test 2-3-4">
var copiedValue = copy("#testVal").val()

Copy Element Text - text()

<div id="test">Test Content</div>
var copiedText = copy("#test").text()

Copy Element HTML - html()

<div id="test2">Test Content2</div>
var copiedHtml = copy("#test2").html()

Copy Current URL - url()

var copiedUrl = copy().url()

Copy Selected Text - selected()

<div>My Text</div>
var copiedSelected = copy().selected()