I jsut checked the sample of jQuery UI that opens a dialog, it’s strange that the message needs to be written in HTML and read it by jQuery selector:
http://jqueryui.com/demos/dialog/
<script>
$(function() {
$( "#dialog" ).dialog();
});
</script>
<div class="demo">
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
What I want to do is quite simple, I want the dialog to display a string defined as a js variable, like this:
var cmd_str = "abcdefg";
$(cmd_str).dialog();
But this doesn’t seem to work well.
It cannot be just any string, it needs to be html.
or maby a cleaner version:
Further explanation:
$("abcdefg")would match a<abcdefg />element as$("a")would match a<a />element.To destroy:
Easiest would be to save the jquery object used for the dialog in a variable like this.