Chrome creates an alert () window with the last 2 words on two separate lines. How to fix?

I have the following JS that creates a warning window:

alert("You have selected the maximum number of funds available for comparison. Please ensure only five funds have been selected for your basket");

Chrome creates a warning window as follows:

enter image description here

with the last two words translating on separate lines.

Has anyone seen this before? Any ideas how to fix this ?!


I wanted to add another screenshot, since I can reproduce this error: --Jeremy

enter image description here

+3
source share
5 answers

@DaveDev, here is the image you requested. I think he looks good enough.

Code from @dr jimbob's answer.

enter image description here

+1
source

This seems to be a bug with older versions of Chrome.

http://code.google.com/p/chromium/issues/detail?id=83670

Chrome 12 linux , /. , , 70 :

alert("You have selected the maximum number of funds \n"+
      "available for comparison. Please ensure only five \n"+
      "funds have been selected for your basket.");

, linebreaks - ( ), - , .

/ , . , , alert (, ajax jquery).

+5

, , , . , , "\n" .

+1

, , , Chrome (12, Windows 7), . HTMLTidy - HTML-?

[] , , Chrome. @code.google.com Chrome

+1

The solution I came across is to add + "\" (backslash space) at the end of the line. Each of my text lines ends with a \ n character anyway, so my line now ends with "\ n \". Then it seems that I can use as much as I want. Do not ask me why this works. Maybe this will work for you? Just call me persistent!

+1
source

All Articles