Salesforce: How to use Javascript and CSS in Visualforce Custom pages

In my previous page, I’ve explained How to use Javascript in Standard Pages.

Here I’m going to explain you about to use Javascript and CSS in your custom pages using Code Editor.

  1. Go to Setup –> Develop –> Pages and Click on New button to create a new visualforce page.
  2. Give a page name in Label and remove code from texteditor and paste below code.
  3. <apex:page showHeader="false">
        <head>
            <apex:stylesheet value="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"/>
            <apex:includeScript value="//code.jquery.com/jquery-1.11.1.min.js"/>
            <script>
                $(function(){
                    alert('Javascript and CSS injected');
                });
            </script>
        </head>
    </apex:page>
  4. Now save your page and click on Preview button. You have successfully added your CSS and Javascript in pages.

Thanks For Reading… 🙂

Advertisements

One thought on “Salesforce: How to use Javascript and CSS in Visualforce Custom pages

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s