Date: 2011aug8
Language: javaScript
Platform: jQuery
Q. I don't like manually creating <div>'s for my jQuery dialogs.
Can I do it programatically?
A. Yes, here's a function to do that:
function prepDialogDiv(id) {
if ($('#'+id).size() == 0) {
$('body').append('<div id='+id+'></div>');
}
else {
$('#'+id).html('');
}
}
function exampleUse() {
prepDialogDiv('hello');
$('#hello').html('Hello!');
$('#hello').dialog({
width: '60%',
height: 650,
title: 'Hello',
modal: true,
});
}
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment