Take the 2-minute tour ×

Is it possible to copy some text to clipboard by clicking on an element of SVG object using jQuery? I used Zero Clipboard for copying to clipboard by pressing simple button, but similar approach did not worked in this case - it could not bind flash to SVG object. Please advise - is there any way to do this?

My code report error SyntaxError: An invalid or illegal string was specified in zclip module.

<object data="vas.svg" type="image/svg+xml" id="svgmap"></object>
<script type="text/javascript" src="jquery.zclip.min.js"></script>
jQuery(window).load(function () { 
var svgobject = document.getElementById('svgmap').contentDocument.getElementById('path3627');
copy:'Some Text'});
share|improve this question
add comment

1 Answer

Maybe zclip is confused because of the svg namespace of the element.

Bind to the click event of the element and invoke clip.setText() manually in the event handler.

share|improve this answer
Thank you, Aaron. But I have to glue the flash clip to the SVG object by using clip.glue() by providing object`s id. But SVG object is not accessible by id. Please advise. –  Vitaly Mirsky Jan 18 '13 at 9:07
Why do you have to "glue the flash clip"? Zero Clipboard works perfectly fine without attaching it to any DOM node. See code.google.com/p/zeroclipboard/wiki/… for invoking it without "gluing" –  Aaron Digulla Jan 18 '13 at 14:41
add comment

Your Answer


