views:

146

answers:

2

Jeditable is inserting extra spaces around the actual text in a text area for me when I click to edit some text. How do I trim this or actually fix this?

A: 

Hmm, that's strange. I'm not getting that problem with Jeditable.

Oh well, jQuery has a trim function:

$.trim("  hello, how are you?  ");
Baloneysammitch
+1  A: 

Found the reason. And it is insane!

In place edit will insert space around the text if you html looks like following

<div id="inplace_edit_this">
     This is some text that will be edited in-place.
</div>

And it will NOT insert space around the text if your html looks like this

<div id="inplace_edit_this">This is some text that will be edited in-place.</div>

I wonder what causes this. This is probably because of the difference in the ways the browser and Javascript interpret the HTML.

Chirantan