javascript - string literal contains an unescaped line break
Get the solution ↓↓↓I have an error in console
Uncaught SyntaxError: '' string literal contains an unescaped line break
'<ul>\n' +
'<?php for ($i = 1; $i < 31; $i++){
echo '<li onclick="updateBasket('.$i.','+value['basketID'].')"><?= $i ?></li>';
}
?>'+
'</ul>\n' +
Answer
Solution:
Try this. This will replace your PHP loop with the same thing but in JavaScript. Replace everything including the lines that open and close the<ul>
.
// End previous concatenation.
'<ul>\n';
// Insert 30 list items.
for (let i = 0; i < 30; i++)
tr += '<li onclick="updateBasket(' + i + ', ' + value['basketCount'] + ')">' + i + '</li>';
// Continue your concatenation as before.
tr +=
'</ul>\n' +
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: integrity constraint violation: 1452 cannot add or update a child row: a foreign key constraint fails
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.