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,591
  • 8
  • 52
  • 103
tapaljor
  • 217
  • 1
  • 6
  • 20
  • 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
  • 62,337
  • 13
  • 111
  • 105
3

Use \n for line break in alert message.

alert("Good\nByee");
Pranav C Balan
  • 110,383
  • 23
  • 155
  • 178
1

\n character is used as newline character:

alert("Good\nByee");
Milind Anantwar
  • 79,642
  • 23
  • 92
  • 120