Add jQuery UI Button to UI Dialog loaded from Ajax
I'm opening and closing dialogs that are dynamically created using ajax. I'd like to be able to have the buttons that appear on the dialogs use the jQuery UI button. I can do this by calling $("button").button(), but that affects every button element. How can I be specific to only affect the buttons that appear on this dialog?
var $dialog = $('<div>').load('/Dialog').dialog({
autoOpen: false,
title: 'Dialog',
开发者_运维技巧 height: 250,
width: 750,
resizable: false,
modal: true,
show: "fadeIn",
hide: "fadeOut"
});
$('#btnOpenDialog').click(function () {
$dialog.dialog('open');
return false;
});
I'll use jAndy's suggestion and just use the Dialog buttons. I was attempting to use already existing buttons in a HTML page I was loading through ajax. The dialog buttons do what I need them to do and look cleaner.
精彩评论