Quantcast
Channel: Topic Tag: database | WordPress.org
Viewing all articles
Browse latest Browse all 11065

DionDesigns on "Don't trim space at the end"

$
0
0

You could use javascript to change the spaces to the &nbsp HTML entity (";" left off the end because the editor doesn't use htmlspecialchars() on code tags) before the form is submitted, and when reading the option in your plugin, you could filter it with htmlspecialchars_decode().

The FORM tag would look something like:

<form method="post" action="options.php" onsubmit="fix_input()">

and the script would look something like:

<script>
function fix_input() {
	var x = document.getElementById('auto_image_before_text');
	// add the ";" character to "&nbsp"!
	x.value = x.value.replace(/ /g, '&nbsp');
	return true;
}
</script>

Viewing all articles
Browse latest Browse all 11065

Trending Articles