简体   繁体   English

jQuery 模态对话框取消按钮不起作用

[英]jQuery modal dialog cancel button isn't working

I am using jQuery modal dialog in my web application.我在我的 web 应用程序中使用 jQuery 模态对话框。 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.我使用了一个button (cancel)并想通过单击它来关闭对话框,但它不起作用,而disable & destroy正在工作。
any idea please....任何想法请....

Code:代码:

$("#dialog-form" ).dialog({
          ....
         buttons: {
             Cancel: function() {
          $( this ).dialog( "close" );  // dialog doesn't close

         //   $( this ).dialog( "destroy" ); (it's working)
         //   $( this ).dialog( "disable" ); (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.eg: 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.我遇到的问题是由于缺少几个文件。例如:有一个 CSS 文件,我们可以通过直接链接或直接下载文件并将其放入您的 web 应用程序中,然后链接到您自己的服务器。

solution 1 :解决方案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.独奏2:只需下载 css 文件并将其放入您的服务器。 as i downloaded a css file called jquery.ui.all.css and put this inside of my webApplication/lib .当我下载了一个名为jquery.ui.all.css的 css 文件并将其放入我的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/.....).这就是我犯的错误,我再次分别下载了这两个文件并将其放在我的 web 应用程序的同一文件夹中(my_web-App/lib/.....)。

Problem due to jQuery file: make sure you always use the updated version of jQuery file. jQuery 文件导致的问题:确保始终使用 jQuery 文件的更新版本。 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 ).这是我卡住的地方,但最后我发现我使用的是 jQuery 文件的旧版本( jQuery v1.3.2 ),而我需要最新的文件( jQuery v1.6.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM