Live comment preview update
Samuel made a change to the live comment preview code and I've installed it here. I'm going to document the change here in case I ever have to install it again.
Thanks for the fix, Samuel!
New and improved ReloadTextDiv code:
function ReloadTextDiv()
{
var NewText = document.getElementById("DynamicText").value;
splitText = NewText.split(/\n/);
var DivElement = document.getElementById("TextDisplay");
var i = 0;
DivElement.innerHTML = '';
for(i = 0; i < splitText.length; i++) {
if(splitText[i].length > 0 ) {
DivElement.innerHTML += splitText[i] + "<br />";
}
}
}
5 Comments
5 TrackBacks
Listed below are links to blogs that reference this entry: Live comment preview update.
TrackBack URL for this entry: http://www.beantowngeek.com/cgi-bin/mt/mt-pong.cgi/202
This update was significant enough that I decided to actually make it a post of its own.... Go back and... Read More
Live comment preview allows commentors to see what their comment will look like as they type it. It's a neat trick, although it works best if you have your comment posting form on the individual entry archive page or otherwise... Read More
Converting journal from b2 to MT. Read More
I'm finally converting my journal from b2 to movabletype. Here's why and a list of articles/plugins/tricks I implemented in my new MT journal... Read More
Live comment preview allows commentors to see what their comment will look like as they type it. It's a neat trick, although it works best if you have your comment posting form on the individual entry archive page or otherwise... Read More





I updated the code so it wraps each paragraph in paragraph tags instead of brackets. I was using the brackets to debug.
Oopsie...
You should take out the if statement inside that for loop, otherwise if you put in blank lines.
like that, it will trim them out.
It looks like MT trims them out any way. NeverMind (blame that one on Brad, it was his idea
)
ahhh, so is it cooler?
YOU are cool, that's for sure
I like it because it's a more accurate representation of the comment you're leaving.
I think you're really cool too!