I have a page with various textareas which can be edited using Scriptaculous (is there a better option?):
<h4>
<span id="someID">
<?php echo $_SESSION['someID']; ?>
</span>
</h4>
The PHP file looks like so:
<?php
if(!isset($_SESSION['someID']))
$_SESSION['someID'] = "Some text which spans more than <br />one line of a textarea";
?>
When I click on the element and it becomes a textarea, the line breaks are present. However, when the textarea loses focus and goes back to being whatever element it was, the line breaks are lost.
Is there a way to preserve the line breaks? Should I be somehow using \n instead of <br />?
Exacly - in
<textarea>break line tag<br/>is treated as a text.If you change it to
\r\nit will works.Why additional
\r? For example in Windows/IE/etc simple\nis not enough. ;)