function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Debendra Ray 8Debendra Ray 8 

Using JQuery in visualforce page

Hi,

Please let me know how to use J Query in a VF Page? 

Thanks & Regards,

Debendra
RD@SFRD@SF

Hi Debendra,

You can use the JQuery library in VF by uploading the JQuery library as a Static resource and then referencing the Static resource in Salesforce.

Hope it helps
RD

Prady01Prady01
Hi there below is the sample code to use Jquery in VF page.
<apex:page controller="weatherForecastCon" showHeader="false">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
    var jq = $.noConflict();
    jq(document).ready(function(){
        alert('Jquery loaded to page on page load');
    });// End of DOM LOAD 
</script>

</apex:page>
You will get an alert message when the page is loaded, this mean your jquery is loading and you can develop more on the same.
Hope this helps!

Thank you
PSM
Prady01Prady01
Woops! 
 
<apex:page showHeader="false">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
    var jq = $.noConflict();
    jq(document).ready(function(){
        alert('Jquery loaded on the page');
    });// End DOM LOAD
    
    
</script>

</apex:page>

Thank you
PSM
Debendra Ray 8Debendra Ray 8
Hi PSM , RD,

Thanks - Please could you send me a document on how to upload a statis resource and reference it in the VF page?

Regards,

Debendra
RD@SFRD@SF
Debendra if you use PSm's approach you wont need the static resource approach. This also makes sure the library file updates are also in sync,as its referencing the file from the external source