# HTML Editor type formatting with JS?

**URL:** <https://forum.kirupa.com/t/html-editor-type-formatting-with-js/236943>\
**Category:** web dev\
**Created:** [August 25, 2007, 9:31am UTC](https://forum.kirupa.com/t/html-editor-type-formatting-with-js/236943 "2007-08-25T09:31:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shard](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@Shard](https://forum.kirupa.com/u/Shard)\
**Post date:** [August 25, 2007, 9:31am UTC](https://forum.kirupa.com/t/html-editor-type-formatting-with-js/236943/1 "2007-08-25T09:31:11Z")

</div>

Hi all, I have a Rich Text Editor I have written for a client and one of the options is to view the source as HTML, which basically grabs the innerHTML of the iframe and places it in a div. The problem is that is just dumps a single line (since its now a string). Is there anyway to format that string as though you were looking at it inside an html editor (with tabs and divs on new lines etc etc). I could do it manually in a function but i thought someone may have already written a function or class to reformat strings as html. any ideas would be greatly appreciated 🙂
