Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <link rel="stylesheet" type="text/css" href="https://skylightanimation.github.io/assets/plugin/font-awesome/4.7.0/css/font-awesome.css">
- <link rel="stylesheet" type="text/css" href="https://skylightanimation.github.io/assets/plugin/bootstrap/3.3.7/bootstrap.min.css">
- <script type="text/javascript" src="https://skylightanimation.github.io/assets/plugin/jquery/jquery-3.4.1.min.js"></script>
- <script type="text/javascript" src="https://skylightanimation.github.io/assets/plugin/bootstrap/3.3.7/bootstrap.min.js"></script>
- <div class="container">
- <br>
- <div class="thumbnail text-box">
- <div id="text-copy">
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
- quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
- </div>
- <button class="btn btn-xs btn-copy btn-primary">
- <span class="fa fa-copy"></span> Copy
- </button>
- </div>
- </div>
- <style type="text/css">
- .btn-copy{
- position: absolute;
- top: 0;
- right: 0;
- margin: 5px 10px;
- }
- .text-box{
- position: relative;
- }
- </style>
- <script type="text/javascript">
- $(document).ready(function(){
- $('.btn-copy').on("click", function(){
- var value = $('#text-copy').text();
- var $tempCopy = $("<input>");
- $("body").append($tempCopy);
- $tempCopy.val(value).select();
- document.execCommand("copy");
- $tempCopy.remove();
- })
- })
- </script>
Advertisement
Add Comment
Please, Sign In to add comment