Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Click div & copy code to pasteboard?

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #41788
    Rugg
    Participant

    Howdy All,

    Curious if anyone can suggest a method, using jQuery perhaps, to click a div and have the related code copied to the pasteboard. Or something similar.

    Thank You

    #120044
    chrisburton
    Participant

    I used ZeroClipboard (flash) because it’s the only way to avoid a Javascript popup alert.

    This is what bit.ly uses along with majority of other sites.

    #120053
    dfogge
    Participant

    chris is correct. due to security issues javascript doesnt have direct access to the OS clipboard.

    in the past i’ve used this plugin: https://sites.google.com/site/yangshuai10/jquerycopyplugin

    note that it also requires flash, but is really easy to implement.

    #120164
    chrisburton
    Participant

    @NSR Click the titles and you will see it in action

    http://html-ipsum.com

    #120173
    chrisburton
    Participant

    Not with flash. It does not work on some Android tablets either.

    #120185
    chrisburton
    Participant

    There is a way with jQuery/Javascript but the user receives a popup alert (stated above).

    Your best bet is to detect if flash is supported (somehow), if not, remove the flash button. The user can tap (click) on the input and copy it the hard way.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.