I'm trying to get a jQuery dialog to close open clicking cancel, and open a new one. Upon clicking CANCEL I have it set up to open the first dialog. Don't mind the actual simpledialog it's trying to open, I know it doesn't make sense for it to open that dialog... just testing at this point... and no second dialog comes up upon close of the first? Nothing happens when I hit cancel, first dialog stays up. Using SimpleDialog2 Please help!
If you want to maintain the methodology of creating a dialog on every click, you should use the destroy method of the plugin ( assuming it has one) instead of just closing it. Otherwise you will append a new eleemnt to the DOM each and every time and they will always be there
Staying with the creation on the fly concept, you would simply open other dialog by triggering a click on the button/element that is delegated already to open it.
Assuming you have multiple rows of these buttons you would need to use a method like addClass to track which row was clicked on so you can find the correct eleement to trigger the click on.
Another approach is make a function for each dialog with an argument to pass in something like row ID or the actual element clciked in order to process your key
inside the dialog.
$(document).delegate('#simplebool', 'click', function() {
openDialog1( this);
})
function openDialog1( el){
var self=el; /* use this to replace "this" in dialog confirm code */
$('<div>').simpledialog2({......})
}
Now you can call dialog 1 from inside dialog 2 and from the handler it is already being opened in