jQuery modal dialog cancel button isn't working
I am using jQuery modal dialog in my web application. I have used one button (cancel)
and want to close dialog by clicking on it but it's not working, while disable & destroy
is working.
Code :
$("#dialog-form" ).dialog({
....
buttons: {
Cancel: function() {
$( this ).dialog( "close" ); // dialog doesn't close
// $( this ).dialog( "destroy" ); (it's working)
// $( this ).dialog( "disable" ); 开发者_Python百科(it's working)
}
I realized now, it was my silly question but i hope it'd be helpful to someone. The problem i was getting due to missing of several files.e.g : There is a CSS file eithier we can use by linking directly or just download the file and put it in your web application and then link to your own server.
solution 1 :
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/ui.all.css"/>
solotion 2 : just download the css file and put it in your server. as i downloaded a css file called jquery.ui.all.css
and put this inside of my webApplication/lib
. Now i can linked
<link rel="stylesheet" href="my_web_app/lib/jquery.ui.all.css"/>
but here is a big deal, you need to check the file if it is importing some other files or not, as i went through this file and found that it is importing two other files.
@import "jquery.ui.base.css";
@import "jquery.ui.theme.css";
This is what i was making mistake, again i downloaded these two files separately and put it in the same folder of my web app (my_web-App/lib/.....).
Problem due to jQuery file : make sure you always use the updated version of jQuery file. This is where i got stuck but finally i found that i am using the old version (jQuery v1.3.2
) of jQuery file while i was needed latest one (jQuery v1.6.2
).
精彩评论