Reputation: 113405
If possible I want to change only the ejs
file that looks like:
...
<?= comment.description -?>
...
comment.description
contains something like this:
foo
Lorem ipsum dolor sit amet
Is it possible to execute JavaScript code inside of template before using comment.description
?
I only want to delete the first line of comment.description
:
comment.description = comment.description.split("\n").slice(1).join("\n");
Upvotes: 0
Views: 2204
Reputation: 2834
=
means that what's inside is going to be visible in html. To make a variable or compute JS you don't need =
.
E.g.:
<? comment.description = comment.description.split("\n").slice(1).join("\n"); -?>
<?= comment.description -?>
Upvotes: 2