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
  • 3,827
  • 1
  • 36
  • 36

2 Answers2

2

Just add a newline \n character.

alert('The transaction has been approved.\nThank you');
//                                       ^^
Nina Scholz
  • 351,820
  • 24
  • 303
  • 358
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,636
  • 1
  • 13
  • 19