我希望找到在jQuery中的操作符,以便在PHP代码中内嵌jq代码时,将代码写在下一行。
这是我的工作代码:
<?php
$addoldgoldrow = '
$(document).on("click",".add_btns",function(e) {
e.preventDefault();
var markups = "<tr class=\'rowaccs\'><td><input type=\'text\' class=\'sl_no\' name=\'sl_no[]\' style=\'width: 100%\'></td><td><input type=\'text\' class=\'oweight inputbox input_table1\' name=\'oweight[]\' style=\'width: 100%\'></td><td><input type=\'text\' class=\'ostone_weight inputbox input_table1\' name=\'ostone_weight[]\' style=\'width: 100%\'></td><td><input type=\'text\' class=\'ovd inputbox input_table1\' name=\'ovd[]\' style=\'width: 100%\'></td><td><input type=\'text\' class=\'onet_weight inputbox input_table1\' name=\'onet_weight[]\' style=\'width: 100%\'></td><td><input type=\'text\' class=\'orate inputbox input_table1\' name=\'orate[]\' value=\'' . $metal_rate . '\' style=\'width: 100%\'></td><td><input type=\'text\' class=\'oamount inputbox input_table1 table1_end row_end\' name=\'oamount[]\' style=\'width: 100%\' readonly></td><td><span class=\'rowcloseoldgold\'><i class=\'fa fa-times\' style=\'color: #C11429;\' aria-hidden=\'true\'></i></span></td</tr>";
$("table#old_gold tbody").append(markups);
indexassigneroldpurchase();
});
';
$this->registerJs($addoldgoldrow, View::POS_READY);
?>
我正在尝试做这样的事情
<?php
$addoldgoldrow = '
$(document).on("click",".add_btns",function(e) {
e.preventDefault();
var markups = "<tr class=\'rowaccs\'>
<td><input type=\'text\' class=\'sl_no\' name=\'sl_no[]\' style=\'width: 100%\'></td>
<td><input type=\'text\' class=\'oweight inputbox input_table1\' name=\'oweight[]\' style=\'width: 100%\'></td>
<td><input type=\'text\' class=\'ostone_weight inputbox input_table1\' name=\'ostone_weight[]\' style=\'width: 100%\'></td>
<td><input type=\'text\' class=\'ovd inputbox input_table1\' name=\'ovd[]\' style=\'width: 100%\'></td>
<td><input type=\'text\' class=\'onet_weight inputbox input_table1\' name=\'onet_weight[]\' style=\'width: 100%\'></td>
<td><input type=\'text\' class=\'orate inputbox input_table1\' name=\'orate[]\' value=\'' . $metal_rate . '\' style=\'width: 100%\'></td>
<td><input type=\'text\' class=\'oamount inputbox input_table1 table1_end row_end\' name=\'oamount[]\' style=\'width: 100%\' readonly></td>
td><span class=\'rowcloseoldgold\'><i class=\'fa fa-times\' style=\'color: #C11429;\' aria-hidden=\'true\'></i></span></td</tr>";
$("table#old_gold tbody").append(markups);
indexassigneroldpurchase();
});
';
$this->registerJs($addoldgoldrow, View::POS_READY);
?>
加号运算符无法正常工作
我尝试使用“+”和“+'
哪个运算符最适合连接这些行?
+
- 第二个片段的确切问题是什么? - Nico Haase