twitter-bootstrap 通过单击 JQuery DataTable 打开 Bootstrap Modal

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30203505/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 22:40:13  来源:igfitidea点击:

Bootstrap Modal Opening by Clicking JQuery DataTable

jquerytwitter-bootstrapmodal-dialog

提问by Paul Anthony Flores

I made a JSFIDDLE, https://jsfiddle.net/t53cyutt/

我做了一个 JSFIDDLE,https://jsfiddle.net/t53cyutt/

and I wanted help with getting a modal to open after clicking on a row from the DataTable.

在单击 DataTable 中的一行后,我需要帮助打开模态。

Any suggestions?

有什么建议?

I thought this small code would do the trick but it won't.

我认为这个小代码可以解决问题,但事实并非如此。

$(document).ready(function () {
$('#jobs').DataTable();


$('#jobs').on('click', 'tr', function () {
    var name = $('td', this).eq(1).text();
    $('#DescModal').dialog("open");
});

回答by Cory

Your Fiddle was missing the bootstrap JS. Bootstap uses selector.modal('show')I updated your fiddle

您的 Fiddle 缺少引导程序 JS。Bootstap 使用selector.modal('show')我更新了你的小提琴