Hi, after long time right? yea...
anyways after long time i am decided to get back again on blogger :) and make this blogger active and helpful to others.
today i come up with some tricks on javascript or on jquery . its a Copy to clipboard.
In IE we have direct window option to make the copy to clipboard code event , but if you try to do same with Firefox or other it wont work
so i thought let add some trick to make the copy thing easy :).
Find my below code and put it in the head section
<script type="text/javascript" src="http://code.jquery.com/jquery-1.3.2.min.js"> </script>
<script type="text/javascript" src="js/jquery.zclip.js"> </script>
<script type="text/javascript">
$(document).ready(function() {
$('a#copy-dynamic').zclip({
path: 'js/ZeroClipboard.swf',
copy: function() { return $('input#dynamic').val(); }
});
});
</script>
and insert this section on your body part.
<div>
<br />
<a href="#" id="copy-dynamic">Click here to copy the value of this input:</a>
<input style="width: 300px; margin-left: 15px;" type="text" id="dynamic" value="Insert any text here." onfocus="if(this.value=='Insert any text here.'){this.value=''}" onblur="if(this.value==''){this.value='Insert any text here.'}" />
</div>
<br />
<a href="#" id="copy-dynamic">Click here to copy the value of this input:</a>
<input style="width: 300px; margin-left: 15px;" type="text" id="dynamic" value="Insert any text here." onfocus="if(this.value=='Insert any text here.'){this.value=''}" onblur="if(this.value==''){this.value='Insert any text here.'}" />
</div>
lets download the swf from GitHubs and put it in your js directory accordingly.
now simple run the application , type the text on the textbox and click on copy button it will copy it in your system just like (Ctrl + C).
Put your comments or suggestion to make this thread active and popular.
Thanks for the Tip Kiran! But where is the jquery.zclip.js? You forgot to post it or its download URL.
ReplyDeleteThank you for comments, as i said its a GitHubs open source application you can easily download it from there.
Deleteanyways just refer this link where you can get the zclip.js as well as flash file also which is supported to it.
http://ego-post.googlecode.com/hg-history/5ffecbea16762eea43f68b7e8c625b29b6618a05/js/jquery.zclip.js
nice work kiran... carry on best of luck !!!
DeleteThanks again..thomas !!
DeleteThank for the Tips you share.It's very useful for all.
ReplyDeleteNice query, I used this code for my website
ReplyDeleteDidn't work for me.
ReplyDeleteI tried the same, send me your email id , i will send you the sample code. :)
Deletemay i know what issues your facing? this will works in IE very well but in Fx(firefox) you need to install that swf file to work. please check the same
ReplyDelete