# \[Javascript\] newbie = replacing line breaks for the break tag

**URL:** <https://forum.kirupa.com/t/javascript-newbie-replacing-line-breaks-for-the-break-tag/147136>\
**Category:** Uncategorized\
**Created:** [May 7, 2005, 2:22pm UTC](https://forum.kirupa.com/t/javascript-newbie-replacing-line-breaks-for-the-break-tag/147136 "2005-05-07T14:22:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaveMania](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@DaveMania](https://forum.kirupa.com/u/DaveMania)\
**Post date:** [May 7, 2005, 2:22pm UTC](https://forum.kirupa.com/t/javascript-newbie-replacing-line-breaks-for-the-break-tag/147136/1 "2005-05-07T14:22:32Z")

</div>

Basically the name explains it all. I have a preview thing on my blog and I need to be able to replace the line breaks with the \<br /\> tag.  
here’s the script so far:

```php
function Preview(){
var Source = document.getElementById("content").value;
var Target = document.getElementById("preview");
Target.innerHTML = Source;}

```

Thanks in advance.
