I want to have two lines in my alert box
Right now I have the following:
<%= link_to 'back', 'history.back()', :confirm => 'Are you sure? This is my second line' %>
I have tried adding '\n' but it is not working, it just writes \n between my text. What should I do?
Thank you in advance
I think the single quotes around your confirm text are causing the \n
to be interpreted literally. Try this:
<%= link_to 'back', 'history.back()', :confirm => "Are you sure? \n This is my second line" %>
If you want a multi-line confirm/alert statement, you will need to use double quote. Single quote will not convert your new line feed \n
This would work: :confirm => "You are about to \n DELETE all tracking information.\nAre you sure?"
Hope this helps ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With