javascript - Simulate button click JS, for clipboard manipulation -


i trying simulate button click, can call

<button id="copy-button" data-clipboard-text="copy me!" title="click copy me.">copy clipboard</button> 

which uses https://github.com/zeroclipboard/zeroclipboard library manipulate clipboard.

i trying write client clipboard on hover of button.

<button id="copy-button" data-clipboard-text="copy me!" title="click copy me.">copy clipboard</button>     <script>      var clip = new zeroclipboard( document.getelementbyid("copy-button"), {        moviepath: "/js/zeroclipboard.swf"    } );    clip.on( 'mouseover', function(client) {        clip.settext( "got in" );        $('#copy-button').simulateclick();        alert("fired");    } );         $.fn.simulateclick = function() {             return this.each(function() {             if('createevent' in document) {                 var doc = this.ownerdocument,                 evt = doc.createevent('mouseevents');                 evt.initmouseevent('click', true, true, doc.defaultview, 1, 0, 0, 0, 0, false, false, false, false, 0, null);             this.dispatchevent(evt);             } else {                 this.click(); // ie             }             });         }   </script> 

i event handler "mouseover" fire, cannot seem simulate button click


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -