Skip to content

Instantly share code, notes, and snippets.

@ralphcallaway
Created November 9, 2012 22:19
Show Gist options
  • Save ralphcallaway/4048689 to your computer and use it in GitHub Desktop.
Save ralphcallaway/4048689 to your computer and use it in GitHub Desktop.
Salesforce component for adding jQuery to a visualforce page
<apex:component >
<apex:attribute name="version"
type="String"
required="false"
description="Version of jquery. Defaults to 1.8.2. See https://developers.google.com/speed/libraries/devguide#jquery for a full list of available versions"
default="1.8.2"/>
<apex:attribute name="minified"
type="Boolean"
required="false"
description="Indicate whether to use minified version. Defaults to true."
default="true"/>
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/{!version}/jquery.{!IF(minified,'min.','')}js"/>
<script>
j$ = jQuery.noConflict();
</script>
</apex:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment