I am using the code below to create a jQuery UI Dialog widget dynamically:
$(function () {
var Selector = $(\"a:contains(\'sometext\')\");
$(Sel
Personally, I managed in this way:
1) Build the html of the dialog, with two span with xxx as default value
There are two variables: xxx and
xxx
2) Make the div ready for being a dialog
$(function() {
$( "#dialog1").dialog({
autoOpen:false,
modal: true,
buttons: {
"Button 1": function() {
$(this).dialog( "close" );
},
"Button 2": function() {
$(this).dialog( "close" );
}
}
});
});
3) And modifying the value of the two spans with this function, before firing up the dialog:
function showDialog(value1,value2){
$("#var1").html(value1);
$("#var2").html(value2);
$( "#dialog1").dialog('open');
}
4) So when you need it, call the function in this way
showDialog('tom','jerry');
You can try this at http://jsfiddle.net/sekmo/L46vb/1/