This:
str = "test test"
ed.selection.setContent(str);//1
Behaves differently than this:
ed.selection.setContent("test test");//2
I’m working with a text editor, and setContent sets the value in the textbox.
1 sets the value in the textbox to
"test test"
and 2 sets it to
"test test".
I can only use variables in the program, not hardcoded values. What should I do? Why does this happen?
Are you using tinyMCE? (Please retag your question)
Their DOCs specificy:
Try adding:
{format : 'raw'}after the string, like so:On both accounts, and see if it helps.
Edit (final, I hope):
use
str = str.replace(/\s/g, ' ');before inserting it to the function.You can test it here, this should work.