You need to sign in to do that
Don't have an account?
prady
Trying to implement a jquery plugin into VF page
Hi,
I am trying to have a jquery plugin into Vf page.
Plugin : Zclip http://www.steamdev.com/zclip/
I have put the files required in to static resource. this plugin uses a swf file
Here is the code to use in html
$(document).ready(function(){ $('a#copy-description').zclip({ path:'js/ZeroClipboard.swf', copy:$('p#description').text() });
Below is my VF page: I am not sure if the path i am giving for is correct in VF page. It doesnt seem to work oin VF page
path:'js/ZeroClipboard.swf',
<apex:page standardController="Account" sidebar="false" showHeader="false" id="page1"> <apex:includeScript value="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"/> <apex:includeScript value="{!URLFOR($Resource.zclip, 'jquery.zclip.min.js')}"/> <script type="text/javascript"> var j$ = jQuery.noConflict(); j$(document).ready(function(){ j$('#copyname1').zclip({ path:"{!URLFOR($Resource.zclip, 'ZeroClipboard.swf')}", // i am not sure if this is the right way to do it copy:j$('#txtaccname1').text() }); }); </script>
<table>
<tr> <td>Account Name :</td> <td> <apex:outputField value="{!account.name}" id="txtaccname1"/> </td><td><input type="button" id="copyname1" class="btn" value="Copy to Clipboard" /></td></tr>
</table>
any ideas why its not working
- $(document).ready(function(){
- $('a#copy-description').zclip({
- path:'js/ZeroClipboard.swf',
- copy:$('p#description').text()
- });
- Go to the static resources through set up --> develope
- Open the SWF static resource file (Click 'View File')
- Copy the link location and use it like;
<apex:page standardController="Account" sidebar="false" showHeader="false" id="page1">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://www.steamdev.com/zclip/js/jquery.zclip.min.js"></script>
<apex:form>
<script type="text/javascript">
$(document).ready(function(){
$("#copyname1222").zclip({
path: "https://ap1.salesforce.com/resource/1325103156000/shailesh__zzSWF",
copy:function(){return $('#copyname1').val;}
});
});
</script>
Also, remove the table that you have used, it will cause error.
Use just '$' and not 'j$'
Thanks,
Shailesh Patil.
For Path:
Is the file the only file in the archive/static resource?
If so use:
i
for the jquery selectors, you have to have every parent item in your page tagged with an id to use the standard # notation....
Try using
j$('[id=THEID]').
instead when you do not have every parent node tagged with an id.