0
I’m a problem, I take information entered by the user in the database and put it in a button with onclick for the user to click put it in a modal so that it can edit, I can not put straight into the modal because there are various information then and they have to change depending on where the user clicks, the problem arises when comes information with line break, (the user used a enter during the insertion of the information), the onclick simply does not work and gives an alert: "Uncaught Syntaxerror: Invalid or Unexpected token".
What left me intrigued that with special characters works normally, only with line break that does not. Follows below the button code:
<button class="btnEdit btn btn-primary btn-xs" onclick="editar(\'' + value.nome + '\' , \'' + value.modulo + '\' , \'' + value.roteiro + '\' ,' + value.id + ')" ><i class="fa fa-edit"></i></button>';
then, this enter will generate an "unfinished string constant" in javascript. You have to treat this entry by removing line breaks. Shows how this data is passed to the button.
– user60252