Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8790903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:46:09+00:00 2026-06-13T22:46:09+00:00

I have created a simple vf page and placed and small jQuery script in

  • 0

I have created a simple vf page and placed and small jQuery script in the vf page (below code). I have added this vf page as an inline VF page in the Case detail page. In the jQuery I am trying to pick up the case number by passing the id of the div in which the case number is present and alerting the result. But I am getting a blank pop-up.
But when I try the same, by placing the jQuery in the sidebar, its working just fine.

<apex:page standardController="Case">
<script src="/resource/jQueryLatest" type="text/javascript"></script>
<script type="text/javascript">
j$(document).ready(function(){
    var caseNumber = j$("#cas2_ileinner").text();
    alert(caseNumber);
});
</script>
</apex:Page>

Problem: not able to access the DOM elements of the standard detail page from a jQuery script which is placed in the inline vf page on the same page.

please help!

Regards
Sam

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:46:10+00:00Added an answer on June 13, 2026 at 10:46 pm

    Yep, that “works as expected”. Visualforce is served from different domain (*.visual.force.com) and your browser prevents cross-site Javascript.

    Use merge field in the VF page instead, you don’t need JS to obtain it 🙂

    var caseNumber = '{!Case.CaseNumber}';
    

    EDIT:

    The nasty trick with embedding static resource in section header:

    You need a static resource that has pure JavaScript code, no tags, styles etc.

    alert('Hello StackOveflow!'); //is OK,
    <script>alert('Hello StackOveflow!');/* is not OK */</script>
    

    Then you simply reference it in the page block section name: page layout editor

    Considerations:

    1. If you have dependencies (first to load jQuery, then some code that relies on it) I think it’s best to use 2 section headers (you could also put your code after jQuery code but that defeats the purpose of reusable library). Use checkboxes to control when you want to display it.
    2. It’s best to place these sections at the bottom of the “detail” – they look a bit ugly (especially on edit page) and if they want to refer to fields on the page the fields would have to be already loaded.
    3. The Javascript is injected exactly as written in the static resource. {!megefields} syntax will not be substituted server side with values you’d expect.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created blank C#/XAML Windows 8 application. Add simple XAML code: <Page x:Class=Blank.MainPage
I am using jquery mobile. I have created a very simple page where there
Could someone help me on this, I have created simple web services using axis2
I have created the simple web service. Code: [ServiceContract] public interface ITsdxService { [OperationContract]
I have created this simple program to learn shared_ptr using namespace std; #define Yes
Scenario 1 (That Works) This is a POC i created. I have a script
I have created a simple web page in Photoshop and want to use it
I have a simple page, it's structure is as follows (pseudo code) : <aspx
I have am trying to create a simple voting page. There are a few
I'm trying to create a simple portfolio page. I have a list of thumbs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.