You need to sign in to do that
Don't have an account?
udhayakumar thangaraju
Standalone static resource is not working in Visualforce Page
I created a static resource called jsquery by uploading Jquery.js and then tried to include the static resource in VF as follows
<apex:page >
<!--<apex:includeScript value="{!URLFOR($Resource.jsquery, 'jquery-1.11.2.min.js')}"/>-->
<apex:includeScript value="{$Resource.jsquery}"/>
<script>
alert('Test...');
jQuery(document).ready(function() {
alert("Hello My Jquery is working!!!!");
});
</script>
<a href="#">Test</a>
</apex:page>
However, while executing the visualforce page, first alert is shown and second is not shown. Browser console says JQuery is not an object or null.
Can some help me to find out what is going wrong?
<apex:page >
<!--<apex:includeScript value="{!URLFOR($Resource.jsquery, 'jquery-1.11.2.min.js')}"/>-->
<apex:includeScript value="{$Resource.jsquery}"/>
<script>
alert('Test...');
jQuery(document).ready(function() {
alert("Hello My Jquery is working!!!!");
});
</script>
<a href="#">Test</a>
</apex:page>
However, while executing the visualforce page, first alert is shown and second is not shown. Browser console says JQuery is not an object or null.
Can some help me to find out what is going wrong?
you need to use <apex:includeScript value="{!$Resource.jsquery}"/> instead of <apex:includeScript value="{$Resource.jsquery}"/>
Cheers!
All Answers
you need to use <apex:includeScript value="{!$Resource.jsquery}"/> instead of <apex:includeScript value="{$Resource.jsquery}"/>
Cheers!
In your case, if you have uploaded a stand-alone file "'jquery-1.11.2.min.js" and named it "jsquery", then refer it like this:
In above code, you've missed "!" in merge field.
For more info, visit the following link:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_resources.htm