Support Rules and Guidelines
Before you post your support topic, please remember to:
  • Read the support forum rules.
  • Check the wiki and use search to see if your problem can be answered there first.
  • Link your board please, and make sure that the problem on your board is visible to guests or provide a test account.
  • Do not post Board Wrappers and CSS unless requested. With a board link, this is not necessary.
  • Be as descriptive as you can and use as many details as possible when describing your problem.
  • Please briefly mark any links to forums that may not be work-safe.
This will help ensure your support issue will be attended to in a quick and efficient manner.

  Add ReplyNew TopicNew Poll

 Clipboard.js not working, hail mary pass
Link: Test forum

I saw on another support post from 2016 where John & a user named Dusty showed another user how to use clipboard.js on their skin.

I've been trying all day to get it to work on my private forum and it's not happening. I was hoping someone could help me understand so I can get it to work.

I've tried
  • installing the clipboard.min.js file from both the src and dist folders
  • linking it from 3rd party CDN provider
  • taking examples directly from the documentation
  • putting the script in the head tag
  • putting the script below the body tag
  • spamming button repeatedly going "y u no work tho"
I'm seeing this error on the console view but I don't know what it means.

Any help would be appreciated. Losing hair over this. :/

This post has been edited by Widow's Peak: Jun 15 2017, 02:20 AM
This might work but you have to really read the read me file.

Add me on Line Jabber me
Or join the conference room

user posted image
Yeah... that is what I'm using, and what I took examples directly from.
Oh hey look it's my own username

   var clipboard = new Clipboard('.btn');
   clipboard.on('success', function(e) {
   clipboard.on('error', function(e) {

Has to go after the elements it's being called on. Put it in the footer and you should be good.
Haha, yeah, sorry to throw you under the bus. I couldn't find the thread again so tried to give details about it, only to find the thread after all and pop it in as a link. I was tired and frazzled when I wrote the HALP request last night.

I am not gonna lie, I was a little sad when you suggested moving it below everything. I tried all three script links (dist > clipboard.min.js, src > clipboard.min.js, and the CDN min js) + moving the function thingie below the board tag and in the head tag earlier yesterday and nothing worked.

But today I moved it below the copyright and for some reason that worked?!?! So, I have no idea why it works better under copyright than it does the < % board tag, but I'm not gonna question it anymore.

Thank you thank you thank you! Now I just need to buy some hair extensions.

This post has been edited by Widow's Peak: Jun 15 2017, 02:41 PM
Haha, not a problem, it was just amusing to see my own name pop up like "HEY THAT'S ME!"

Technically that script could go in the head tags as well, but it would need to have an event listener that triggers on document load. Since it's not wrapped in the document load tags
document.addEventListener('DOMContentLoaded', fn, false);

or the JQuery equivalent
$(function(){ })

it's executed in-line as the browser parses the page, and since the target buttons and inputs didn't technically exist yet (since they were slightly further down the page), the script didn't attach to anything.
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Share this topic:
« Next Oldest | General Support | Next Newest »

Options Add ReplyNew TopicNew Poll