I am developing a wysiwyg editor because most of the ones I have found do not work the way I would like them to.
I have most of it done, "bold, Italic, Forecolor, backcolor, etc" but the problem I am having now is the make a view code button.
What I would like to happen is when the user hits the button they see the code and if they hit it again it toggles back to html.
I have tried
$('#wysiwyg').text($('#wysiwyg').html());
It did exactly what I wanted but it did not keep the line breaks, so all of the <p> tags would run together across one line. Does anyone have a better solution that would keep the line breaks, so if there is a line break for the <p> like there if you viewed the html.
as-is. Without it, line breaks (\r\n) are ignored in HTML.