How do I add an HTML tag around every space in an element?

tecniki

New Member
I have a webpage with a contentEditable div and a submit button. When the user clicks the submit button I want to replace all spaces in the contentEditable div with:\[code\]<span class="large"> </span>\[/code\]The problem I've run into is I don't want any of the spaces within pre-existing HTML tags to get edited, and I also don't want to lose them.Here's how an example page would be structured:\[code\]<div id="content" contenteditable="true"> <p class="MsoNormal" style="text-indend:.5in"> Example Text Here </p></div>\[/code\]When a use clicks a submit button I want to replace the spaces in "Example Text Here" only. There could be multiple paragraph elements within the content div or there could be none, depending on how the user entered the text into the element.
 
Back
Top