You need to sign in to do that
Don't have an account?
prati@salesforce
jQuery in Visualforce
Hi.. I have just started learning jQuery in Vf page and was checking online resources . I cam accross these codes , needed some clarity on this.
<apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-1.11.4.min.js')}" />
<apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-ui-1.8.6.custom.min.js')}" />
<apex:stylesheet value="{!URLFOR($Resource.jQuery, '/css/ui-lightness/jquery-ui-1.8.6.custom.css')}" />
I have downloaded[ jquery-ui-1.11.4.custom.zip] and included as a static resource but I am not sure if I need to download something else as well?
Because in the example above there are 3 lines of code. Are they referring to the same jQuery zip folder?
Also please help me get some working example with jQuery in Visualforce page.
<apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-1.11.4.min.js')}" />
<apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-ui-1.8.6.custom.min.js')}" />
<apex:stylesheet value="{!URLFOR($Resource.jQuery, '/css/ui-lightness/jquery-ui-1.8.6.custom.css')}" />
I have downloaded[ jquery-ui-1.11.4.custom.zip] and included as a static resource but I am not sure if I need to download something else as well?
Because in the example above there are 3 lines of code. Are they referring to the same jQuery zip folder?
Also please help me get some working example with jQuery in Visualforce page.
i) Who use static resources
ii) Who source libraries from CDNs
(there are significant number of people on both sides)
I prefer CDNs for now.
VF+jQuery (using CDN)
Mark it as Best Answer, if it helps
All Answers
i) Who use static resources
ii) Who source libraries from CDNs
(there are significant number of people on both sides)
I prefer CDNs for now.
VF+jQuery (using CDN)
Mark it as Best Answer, if it helps
The easy and simplest way to use jquery in visual force is through the static resources...
<apex:page >
<apex:includeScript value="{!URLFOR($Resource.jquery, '/jquery/jquery-ui.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery, '/jquery/external/jquery/jquery.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery, '/jquery/jquery-ui.min.js')}"/>
<script>
j$ = jQuery.noConflict();
if(j$){
alert('Success');
}else{
alert('Failure');
}
</script>
</apex:page>
We use DataTable static resource to present data in table of visualforce page (VFP).
In Controller I have SOQL that order by createdDate DESC:
docs = [select Document_Name__c,CreatedDate from Document__c ORDER BY CreatedDate desc];
For some reason, when changing in script of VFP from j$(document).ready( function () to j$(document).click( function ()
The visualforce page style\design is impact.
How can I still keep the visualforce design and also have the data sorted \ order by createdDate column?
If I use only j$(document).ready( function () then we have the style but ORDER BY CreatedDate desc does not take place.
Thank you all.
Avihai
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js">
</script>
Thanks!