clipboard.js/demo/function-text.html

33 lines
709 B
HTML
Raw Normal View History

2015-10-27 08:53:03 +03:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>function-text</title>
2016-10-17 03:16:02 +03:00
<meta name="viewport" content="width=device-width, initial-scale=1">
2015-10-27 08:53:03 +03:00
</head>
<body>
<!-- 1. Define some markup -->
<button class="btn">Copy</button>
<!-- 2. Include library -->
<script src="../dist/clipboard.min.js"></script>
<!-- 3. Instantiate clipboard -->
<script>
2018-03-01 08:46:48 +03:00
var clipboard = new ClipboardJS('.btn', {
2015-10-27 08:53:03 +03:00
text: function() {
return 'to be or not to be';
}
});
clipboard.on('success', function(e) {
console.log(e);
});
clipboard.on('error', function(e) {
console.log(e);
});
</script>
</body>
</html>