1

I tried to do line break in alert JQuery? It should pop up like this

Good
Byee

alert("Good<br>Byee");

Is there any way to break line in JQuery?

Norbert
  • 2,741
  • 8
  • 56
  • 111
tapaljor
  • 237
  • 1
  • 6
  • 21
  • i would try to avoid alert Boxes in most Cases because they are browser related. Most of the time it will be better to use a little bit css and html for alerts ... its alot more userfriendly! – Simon Müller Aug 18 '16 at 06:29
  • Possible duplicate of [New line in JavaScript alert box](https://stackoverflow.com/questions/1841452/new-line-in-javascript-alert-box) – treyBake Jan 25 '19 at 14:42

3 Answers3

6

This is not the jQuery, this is a pure Javascript

alert('Good\nByee');
Suren Srapyan
  • 66,568
  • 14
  • 114
  • 112
3

Use \n for line break in alert message.

alert("Good\nByee");
Pranav C Balan
  • 113,687
  • 23
  • 165
  • 188
1

\n character is used as newline character:

alert("Good\nByee");
Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125