I have created a custom button on Account layout to test popping up a jQuery modal dialog box.



function requireCssFile(filename) { 
var fileref = document.createElement('link'); 
fileref.setAttribute('rel', 'stylesheet'); 
fileref.setAttribute('type', 'text/css'); 
fileref.setAttribute('href', filename); 

var j$ = jQuery.noConflict(); 

var j$modalDialog = j$('<div></div>') 
.html('Be Apex my friend!') 
autoOpen: false, 
title: 'My Modal Dialog', 
resizable: false, 
width: 400, 
height: 400, 
autoResize: true, 
modal: true, 
draggable: false 


I have been following this article as to how to issue a jQuery modal dialog box from Standard Page Layout.


Upon clicking on this custom button I am getting the following error.

enter image description here

Can someone let me know what is the issue ?

  • 1
    you are trying to access the jQuery from your static resources....did you have jQuery libraries (zip folder) in your resources?
    – sam_s
    Feb 2, 2016 at 2:34
  • That was it..Forgot to add them ..thanks..you can put as answer
    – Rainmaker
    Feb 2, 2016 at 2:47

1 Answer 1


You need to have jQuery libraries included in your static resources file.

For reference Adding jQuery To Your Force.com Application

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .