OK, so I am pulling some text from a PHP variable to insert into a Javascript alert box. I want to be able to designate line breaks but I am having trouble. Instead of inserting a line break as "\n" in the javascript code, it just inserts a line break in the actual code. Here's some php code:
SOLVED: PHP creating dynamic page breaks on a javascript alert box
4
OK, so I am pulling some text from a PHP variable to insert into a Javascript alert box. I want to be able to designate line breaks but I am having trouble. Instead of inserting a line break as "\n" in the javascript code, it just inserts a line break in the actual code.
Here's some php code:
Here is how the code looks on the page:
Once the page loads, the code looks like this:
I want it to look like this:
Here's some php code:
PHP Code:
= "Line 1nLine 2";
Code:
var alertmessage = '<?php echo ; ?>';
alert ('alertmessage'); Code:
var alertmessage = 'Line 1
Line 2';
alert ('alertmessage'); Code:
var alertmessage = 'Line 1nLine 2';
alert ('alertmessage'); - Manfred Ekblad
- [ 1 ] Thanks
- [1] reply
- Kevin-VirtualProfitCenter
Next Topics on Trending Feed
-
4