DataTables 和 jquery 添加模式来编辑/删除每行中的链接

发布于 2024-10-10 00:37:36 字数 424 浏览 0 评论 0原文

我是一个新手,所以如果这是一个简单的问题,请原谅我。

我试图显示一个 jquery 确认框,但运气不佳。常规的 javascript 工作正常。

我正在使用 DataTables,并在最后一列有 2 个图像右边,一个编辑,另一个删除。

我尝试了一个简单的对话框:

     ` $('#datatable tbody tr a.delete img').live( 'click', function () {
    $( "#dialog" ).dialog();

  });`

在 html 中,我有一个带有对话框 id 的 div tage..但是当我单击链接时,我收到一条错误消息“$("#dialog").dialog 不是一个函数”

我有用谷歌搜索这个错误,没有运气。有人有什么想法吗?

I am a newbie so please forgive me if this is an easy one..

I am trying to dislay a jquery confirmation box without much luck.. The regular javascript works fine..

I am using DataTables and have 2 images on the last column on the right, one edit and the other delete.

I tried a simple dialog as:

     ` $('#datatable tbody tr a.delete img').live( 'click', function () {
    $( "#dialog" ).dialog();

  });`

In the html I have a div tage with the id of dialog.. but when I click the link I get an error saying "$("#dialog").dialog is not a function"

I have googled this error to death with no luck.. Anyone have any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深空失忆 2024-10-17 00:37:36

$.dialog()jQuery UI 插件的一部分。

你在这里有一个演示: http://jqueryui.com/demos/dialog/

加载 jQuery,然后jQueryUI 然后你的脚本:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js" type="text/javascript"></script> 
<script>
$(function() {
    $('#datatable tbody tr a.delete img').live( 'click', function () {
      $( "#dialog" ).dialog();
    });
});
</script>

$.dialog() is part of the jQuery UI plugin.

You got a demo here : http://jqueryui.com/demos/dialog/

Load jQuery, then jQueryUI then your script :

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js" type="text/javascript"></script> 
<script>
$(function() {
    $('#datatable tbody tr a.delete img').live( 'click', function () {
      $( "#dialog" ).dialog();
    });
});
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文