Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Uncaught ReferenceError: ZeroClipboard is not defined #28

Open
prokopsimek opened this issue Nov 13, 2014 · 2 comments
Open

Uncaught ReferenceError: ZeroClipboard is not defined #28

prokopsimek opened this issue Nov 13, 2014 · 2 comments

Comments

@prokopsimek
Copy link

Added in Gemfile > bundle install > application.js added "//= require zeroclipboard
"

Created page with code:

<button class='my_clip_button' data-clipboard-target='fe_text' data-clipboard-text='Default clipboard text from attribute' id='d_clip_button' title='Click me to copy to clipboard.'>
    <b>Copy To Clipboard...</b>
</button>

<div class='demo-area'>
  <h4>
    <label for='fe_text'>Change Copy Text Here</label>
  </h4>
  <textarea cols='50' id='fe_text' rows='3'>Copy me!</textarea>
  <h4>
    <label for='testarea'>Paste Text Here</label>
  </h4>
  <textarea cols='50' id='testarea' rows='3'></textarea>
  <p>
    <button id='clear-test'>Clear Test Area</button>
  </p>
</div>


<script>
  $(document).ready(function() {
    var clip = new ZeroClipboard($("#d_clip_button"))
  });

  $("#clear-test").on("click", function(){
    $("#fe_text").val("Copy me!");
    $("#testarea").val("");
  });
</script>

Error in console:

Uncaught ReferenceError: ZeroClipboard is not defined copy_htmls:168
(anonymous function) copy_htmls:168
fire jquery.js?body=1:3120
self.fireWith jquery.js?body=1:3232
jQuery.extend.ready jquery.js?body=1:3444
completed jquery.js?body=1:3475

copy_htmls:168 == line with "var clip = new ZeroClipboard($("#d_clip_button"))"

rails -v && ruby -v && gem list zeroclipboard-rails
Rails 4.1.6
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
*** LOCAL GEMS ***
zeroclipboard-rails (0.1.0)

Any solutions?

@garrettogrady
Copy link

I am having the same problem,.. did you find a solution?

@muslih
Copy link

muslih commented Dec 31, 2015

I also have the same problem, and I already solved it by using below:
RAILS_ENV=production rake assets:precompile
In my production machine

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants