Javascript 删除警报中的换行符

Javascript 删除警报中的换行符,javascript,cakephp,alert,Javascript,Cakephp,Alert,我在索引视图中得到一个删除链接: $alertText = 'Want to delete %s?\n 2nd line'; echo $this->Form->postLink(__('Löschen'), array( 'action' => 'delete', $event['Event']['id']), null, __($alertText, $event['Event']['id'])); 现在我想要一个两行的警报, 因此,我尝试了以下方法,但不起

我在索引视图中得到一个删除链接:

$alertText = 'Want to delete %s?\n 2nd line';
echo $this->Form->postLink(__('Löschen'), array(
   'action' => 'delete', $event['Event']['id']), null,
    __($alertText, $event['Event']['id']));
现在我想要一个两行的警报, 因此,我尝试了以下方法,但不起作用

\n
\\\n
你知道为什么新行的默认行为在这里不起作用吗

尝试使用双引号

$alertText = "Want to delete %s?\n 2nd line";

这真的很奇怪,太多了,我都快发疯了。