TypeError: e is undefined
tlacoding opened this issue · 5 comments
Hi! I want to use jquery.zeroclipboard for my project but when i got an error "TypeError: e is undefined" in console of browser. I called jquery first. Here's my code
<script src="js/jquery.min.js"></script>
<script src="js/zeroclipboard/jquery.zeroclipboard.min.js"></script>
<script>
jQuery(document).ready(function($) {
$("body").on("copy", ".zclip", function(/* ClipboardEvent */ e) {
e.clipboardData.clearData();
e.clipboardData.setData("text/plain", $(this).data("zclip-text"));
e.preventDefault();
});
});
</script>
Works fine for me: http://jsfiddle.net/JamesMGreene/frRfS/
Please create a live JSFiddle/JSBin/etc. that reproduces the issue so that I can help you debug it.
Thanks! Can I run it in my localhost ? I can't hover my button! But i can run your demo in http://zeroclipboard.org/. Please help me! I need it for my project in school.
If by localhost you mean file://
protocol, then you would need to edit the configuration within the code. I'll have to tag a new version that will make that possible as a consumer.
Otherwise, just host your localhost on HTTP and it should work fine.
If you want to use the file://
protocol for your localhost, please try the newly created version v0.2.0
or higher.
Before you attach any event handlers for the beforecopy
/copy
/aftercopy
/copy-error
events, you must first execute the following:
$.event.special.copy.options.trustedDomains = ["*"];
Thanks a lot!