+ 2

How to have a line break in javascript in alert box?

6th Aug 2017, 11:46 AM
Ali Murtaza
Ali Murtaza - avatar
7 ответов
+ 5
"\n" alert("\nok\nku")
6th Aug 2017, 11:47 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 5
@neicore can you show an example? it didn't work for me I use \n for JS update: e.g for html + JS alert txt now https://code.sololearn.com/W9or0EQuF7gF/?ref=app
6th Aug 2017, 1:01 PM
Lord Krishna
Lord Krishna - avatar
+ 4
@neicore that's html & doesn't work in JS this is JS we are speaking.
6th Aug 2017, 12:58 PM
Lord Krishna
Lord Krishna - avatar
+ 2
or you can use the "<br/>" tag, example "this is an alert" + "<br/>" + "with a line break." output ; this is an alert with a line break.
6th Aug 2017, 12:27 PM
Raz
Raz - avatar
+ 2
@Lord Krishna, have you ever used the method? I usually use that
6th Aug 2017, 1:00 PM
Raz
Raz - avatar
6th Aug 2017, 1:15 PM
Raz
Raz - avatar
+ 1
@neicore sweet alert?
6th Aug 2017, 1:02 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar