在click事件中打开一个jquery对话框? [英] Open a jquery dialog in click event?

查看:50
本文介绍了在click事件中打开一个jquery对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何在函数调用中打开一个jquery对话框,其中包含href?

示例代码:



Hi,
How can i open a jquery dialog in the function call which is onclick of href?
example code:

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid black;
}
</style>
<script>
function Launch(){
//open a dialog here
}
</script>
</head>
<body>

<table>
  <tr>
    <td id="side">
      <H1><a href = javascript:Launch()> Launch </a></H1>
    </td>
    <td>Cell B</td>
  </tr>
</table>
<div id="dialog">Your non-modal dialog</div>
</body>
</html>







有人可以帮忙吗?



问候,

Ravi Raj Nukala



我尝试过:



1.在表格和标题之外创建了一个div并尝试调用对话框。

$(#dialog ).dialog('open');




can anyone please help on this?

Regards,
Ravi Raj Nukala

What I have tried:

1. created a div outside of table and header and tried calling the dialog.
$("#dialog").dialog('open');

推荐答案

(#dialog)。dialog('open');
("#dialog").dialog('open');


参考 Dialog | jQuery UI [ ^ ]获取完整文档以及如何使用它。



要使对话框功能起作用,你必须将依赖Javascript / jquery库添加到你的代码中..

the下面的代码将起作用,但你必须开始学习

的基础知识 HTML教程 [ ^ ]

CSS教程 [ ^ ]

JavaScript教程 [ ^ ]

jQuery教程 [ ^ ]

jQuery UI [ ^ ]



refer Dialog | jQuery UI[^] for the complete documentation and how to use it.

To make the dialog function to work, you will have to add the dependency Javascript/jquery libraries to your code..
the below code will work but you have to start learning the basics of
HTML Tutorial[^]
CSS Tutorial[^]
JavaScript Tutorial[^]
jQuery Tutorial[^]
jQuery UI[^]

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
     
    <style>
        table, th, td {
            border: 1px solid black;
        }
    </style>
    <script>
        function Launch() {


#dialog)对话框();

}
< / script >
< / head >
< 正文 >

< 表格 >
< tr >
< td id = side > ;
< h1 > < a href = javascript:Launch() > 启动< / a < span class =code-keyword>>
< / h1 >
< / td < span class =code-keyword>>
< td > 单元格B < / td >
< / tr >
< / table >
< div id = 对话框 style = display:none > 您的非模态对话框< / div >
< / b ody >
< / html >
("#dialog").dialog(); } </script> </head> <body> <table> <tr> <td id="side"> <h1><a href=javascript:Launch()> Launch </a></h1> </td> <td>Cell B</td> </tr> </table> <div id="dialog" style="display:none">Your non-modal dialog</div> </body> </html>


这篇关于在click事件中打开一个jquery对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆