3 回答
TA贡献1842条经验 获得超21个赞
Thakur 在他的回答中是正确的,你有 ' 和 " 混淆了几次。如果你想在未来避免这种问题,你可能需要考虑使用模板字符串,例如:
var $tableRows = `<tr><td>${$row}<td><input id='localLevel ${$uniqueID}' type="edit">
<td><input id='colony ${$uniqueID}' type="edit">
<td><input id='description ${$uniqueID}' type="edit">
<td><input id='oxidase ${$uniqueID}' type="edit">
<td><input id='isolation1 ${$uniqueID}' type="edit">
<td><input id='isolation2 ${$uniqueID}' type="edit">
<td><input id='bioChemComments ${$uniqueID}' type="edit">
<td><input id='IDMALDI ${$uniqueID}' type="edit">
<td><input id='sensiID ${$uniqueID}' type="edit">
<td><input id='organism-${$case}-${$specimen}-544' type='select'>
<td><input id='localComments ${$uniqueID}' type="edit">
<td><input id='comments-${$case}-${$specimen}-544-new' type='edit'>
<td><input id='result-${$case}-${$specimen}-544-n' type='edit'>
`;
TA贡献1836条经验 获得超3个赞
将所有 '" 反转为 "' 并且 type="edit" 应该是 type='edit' ,如下所示:
function addNewCultureRow($row, $case, $specimen) {
var $uniqueID = "." + $row + $case + "." + $specimen;
var $tableRows = "<tr><td>" + $row + "<td><input id='localLevel" + $uniqueID + "' type='edit'>" +
"<td><input id='colony" + $uniqueID + "' type='edit'>" +
"<td><input id='description" + $uniqueID + "' type='edit'>" +
"<td><input id='oxidase" + $uniqueID + "' type='edit'>" +
"<td><input id='isolation1" + $uniqueID + "' type='edit'>" +
"<td><input id='isolation2" + $uniqueID + "' type='edit'>" +
"<td><input id='bioChemComments" + $uniqueID + "' type='edit'>" +
"<td><input id='IDMALDI" + $uniqueID + "' type='edit'>" +
"<td><input id='sensiID" + $uniqueID + "' type='edit'>" +
"<td><input id='organism-" + $case + "-" + $specimen + "544' type='select'>" +
"<td><input id='localComments" + $uniqueID + "' type='edit'>" +
"<td><input id='comments-" + $case + "-" + $specimen + "-544-new' type='edit'>" +
"<td><input id='result-" + $case + "-" + $specimen + "544-new' type='select'>";
return ($tableRows);
}
添加回答
举报