javascript - 数据表中出现“确认”错误。我应该如何解决它?
问题描述
我在确认中使用数据表列。but('do you want cancel?') 那部分出现错误。编号没有错误,但文字是错误的。我们应该如何改变它?在我的代码中
'columns': [
{
"data": null,
"bSortable": false,
"mRender": function (o) { if (o.check_flag == 3){
return '<form action="" method="post" ><input type="hidden" name="idx" value="' +
o.po_id + '?' + o.po_point + '">
<input type="submit" onclick="if(!confirm('do you want cancel?')){return false;}"
value="cancel"></form>';
}else{
return '<span>not cancel</span>';
}
}
}
]
解决方案
正如@Kevin 在评论中所说,转义单引号。我只是添加\'
到您的确认文本的两端。
'columns': [
{
"data": null,
"bSortable": false,
"mRender": function (o) { if (o.check_flag == 3){
return '<form action="" method="post" ><input type="hidden" name="idx" value="' +
o.po_id + '?' + o.po_point + '">
<input type="submit" onclick="if(!confirm(\'do you want cancel?\')){return false;}"
value="cancel"></form>';
}else{
return '<span>not cancel</span>';
}
}
}
]
推荐阅读
- java - JavaFX:只允许在一个方向调整窗口大小
- python - 无法使用 python 脚本从网站上抓取 html 表
- python-3.x - python,featuretools dfs Stream关闭错误问题
- python - 如果任何人在给定的查询文本中使用同义词,Python Whoosh 库也会给出搜索结果
- c++ - 为什么 AddressSanitizer 报告 stack-use-after-scope 错误?
- ruby-on-rails - 将多个迁移文件合并为一个迁移文件
- javascript - React Weather 简单应用程序 - 适用于代码沙盒但不适用于 VSCode?
- c++ - MFC 对话框错误中的 C++ 多线程
- xsd - Xsd 允许属性引用某种类型
- android - ARCore 对象旋转基于我第一次打开应用程序的位置