1

I am using alert function to show a message. But I want to show this message in two lines. The message is "The transaction has been approved. Thank you". The code is:

alert('The transaction has been approved. Thank you');

The result should be:

The transaction has been approved.

Thank you

Community
  • 1
  • 1
Muhammad Awais
  • 4,238
  • 1
  • 42
  • 37

2 Answers2

2

Just add a newline \n character.

alert('The transaction has been approved.\nThank you');
//                                       ^^
Nina Scholz
  • 376,160
  • 25
  • 347
  • 392
0
alert('The transaction has been approved.\n\nThank you');

Actually looks like two(2) new line breaks \n are what you're after, to be specific, per the spacing in your desired output.

mferly
  • 1,646
  • 1
  • 13
  • 19