Calling JQuery dialog from onclick
<p>The HTML below will show a page with 2 buttons. One will open a JQuery dialog the normal way - and is working fine.</p>

<p>The other button is an attempt to open the dialog form a non-jquery function - but it is not working. I am awear that the second button is not how it should be done - but for reasons that I will skip explaining here I would like to know if this is possible at all? </p>

<p>I am new to jquery - so I am sure there are basic things abount namespace etc. that I do not understand fully at the moment. Having tried numerous ways to get it to work without success - I now ask for advise on how this can be done. The more general questions is concerning how "normal" javascript can reference and manipulate JQuery functions.</p>

<p>Can it be done?</p>

<pre><code>&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;My Dialog demo&lt;/title&gt;
    &lt;link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css" /&gt;
    &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
        $(document).ready(function () {
            var $dialog = $('&lt;div&gt;&lt;/div&gt;')
            .html('My Dialog Demo...')
            .dialog({
                autoOpen: false,
                title: 'My Dialog'
            });

            $('#Button1').click(function () {
                $dialog.dialog('open');
                return false; ////cancel eventbubbeling
            });
        });

        function showDialog() {
            $dialog.dialog('open');
            return false //cancel eventbubbeling
        }

    &lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
 &lt;!-- JQuery autowired event--&gt;
&lt;button id="Button1"&gt;Open dialog (JQuery event wireup)&lt;/button&gt;
&lt;!-- Manual --&gt;
&lt;button id="Button2" onclick="showDialog();"&gt;Open (manual onClick event)&lt;/button&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
