Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>On top of not referencing jQuery in a <code>&lt;script&gt;</code> element, and not referenceing jQuery UI in a <code>&lt;script&gt;</code> element, and not linking to some jQuery UI css in a <code>&lt;link&gt;</code> element, and not using an octothorpe <code>#</code> when selecting by id <code>jQuery("#uploadPic)</code>, you also never call your <code>showDialog(...)</code> function:</p> <pre><code>function showDialog(id) { alert("Hi"); $('#' + id).dialog("open"); alert("End"); } </code></pre> <p>Since you have specified <code>autoOpen: false</code> when you called <code>dialog({...})</code>...</p> <pre><code> jQuery("uploadPic").dialog({ autoOpen: false, // &lt;--- modal: true, height: 375, width: 400, draggable: true, title: "Upload Picture", open: function (type, data) { $(this).parent().appendTo("form"); } }); </code></pre> <p>... the dialog is not visible at first. You have to call either <code>open(...)</code> or <code>dialog("open")</code> - like you did in your <code>showDialog(...)</code> function.</p> <p>But since you never call that function, it never opens the dialog.</p> <p>Try this:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;title&gt;Jquery dialog not working in masterpage?&lt;/title&gt; &lt;script type=text/javascript src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type=text/javascript src="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js"&gt;&lt;/script&gt; &lt;link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/base/jquery-ui.css" /&gt; &lt;script language="javascript" type="text/javascript"&gt; // _spBodyOnLoadFunctionNames.push("onloadFunction"); // since I'm not using SharePoint I have replaced this line with jQuery(document).ready(...) below function onloadFunction() { alert("I am in onload Function"); //setup edit person dialog jQuery("#uploadPic").dialog({ autoOpen: false, modal: true, height: 375, width: 400, draggable: true, title: "Upload Picture", open: function (type, data) { $(this).parent().appendTo("form"); } }); jQuery("#open-button").click(function() { showDialog("uploadPic"); }); } function showDialog(id) { alert("Hi"); $('#' + id).dialog("open"); alert("End"); } $(document).ready(onloadFunction); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a id="open-button" style="cursor:pointer;"&gt;Open the dialog&lt;/a&gt; &lt;div id='uploadPic'&gt; &lt;table class="ms-authoringcontrols" style="border-top:1px black solid; border:1px black solid; height:70px " &gt; &lt;tbody&gt; &lt;tr&gt; &lt;td class="ms-sectionheader ms-rightAlign"&gt; Please choose a picture to upload to your picture library. &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload