我希望对话框中的消息显示类似"选择您想要踢/禁止的方式(玩家名)"
我当前的代码如下所示
$(document).on("click", ".btn-ban", function(e) {
var username = ($(this).attr('id'));
bootbox.dialog({
message: "Choose how you want to ban "+$username,
title: "Ban Player",
backdrop:false,
buttons: {
觉得代码的其余部分并不重要
我尝试从 ancor 标签中获取 id,该标签由 PHP 定义为玩家名称。
但是自从我在消息中添加了"+$uername"以来,对话框就不会显示。
有什么想法吗?
它的username
不像$username
,
message: "Choose how you want to ban "+username,
完整代码
$(document).on("click", ".btn-ban", function(e) {
var username = this.id; // you can use it simply without using attr()
bootbox.dialog({
message: "Choose how you want to ban "+username,
title: "Ban Player",
backdrop:false,
buttons: {
如果你想连接php
变量 然后以这种方式使用,
$(document).on("click", ".btn-ban", function(e) {
var username = this.id; // you can use it simply without using attr()
bootbox.dialog({
message: "Choose how you want to ban "+ <?php echo $username; ?>,
title: "Ban Player",
backdrop:false,
buttons: {