Click the button to copy the link to my clipboard [compatible with all browsers]

Source: Internet
Author: User
Tags jquery library

First, take a look at my notes: Click me


Compatible with jquery zclip plug-ins of all browsers for copying to clipboard
Load the jquery library and zclip plug-in

  1. <ScriptType = "text/JavaScript" src = "JS/jquery-1.8.1.min.js"></Script> 
  2. <ScriptSrc = "JS/jquery. zclip. Min. js"></Script> 

Below is a small demo, mainly copying the link in the text box to the clipboard.
Html
  1. <InputType = "text" value = "www.baidu.com" id = "Link"> 
  2. <SpanId = "copybtn">Copy Link</Span> 

Then add the script
Not necessarily the input tag, as long as the text can be obtained.
  1. <Script> 

  2. $ ('# Copybtn'). zclip ({
  3. Path: "zeroclipboard.swf ",
  4. Copy: function (){
  5. Return $ ('# link'). Val ();
  6. }
  7. });

  8. </Script> 

Click the button to copy the link to my clipboard [compatible with all browsers]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.