Log in

View Full Version : echo line breaks within <script>



ggalan
01-06-2011, 03:11 AM
ive tried "\n" but i dont get line breaks. how can i break each line?




echo '<script>';
echo "$('#socialQues').load('ques/ques1.php');";
echo '$("#socialSubjTitle").animate({"left": "24px"}, "fast");';
echo '$("#socialSubj").animate({"left": "74px"}, "fast");';
echo '$("#socialQues").fadeIn(0);';
echo '$("#socialQues").animate({"left": "264px"}, "fast");';
echo '</script>';

Nile
01-06-2011, 03:47 AM
You have to use double quotes "\n" to make a line break, or concatenate it (which is what I recommend in your case). For example:


echo 'Hello!'."\n";

You can only use \n with double quotes just as you can only use variables without concatenating in double quotes.

Good luck