PDA

View Full Version : issue over writing source for richtext......



ajaybabu.darna
Jan 7th, 2010, 05:21 AM
i am writing a code to show the user , what data he had entered in ckeditor as rich text....
but after entering the text while the source is created for it, it is splitting from on line text to multiline text......So javascript is giving a script error....
is there any solution to retain the text in to single line..even if it is entered in multiline??

Philip M
Jan 7th, 2010, 07:35 AM
text = text.replace(/(\r?\n)|(<br>)/gi,"");



All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

ajaybabu.darna
Jan 7th, 2010, 09:00 AM
text = text.replace(/(\r?\n)|(<br>)/gi,"");



All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

thnk u for ur help!!

it is working!!! but what is this "gi" in the syntax?? and also why the Qustn mark(?) u used??

Philip M
Jan 7th, 2010, 10:02 AM
thnk u for ur help!!

it is working!!! but what is this "gi" in the syntax?? and also why the Qustn mark(?) u used??

g = global (i.e. all instances, not just the first one).
i = ignore case
? means matches zero or one time. In other words, if present.

Please do not write in textspeak - you are not limited to 140 characters and people will doubt your literacy.

ajaybabu.darna
Jan 7th, 2010, 10:30 AM
g = global (i.e. all instances, not just the first one).
i = ignore case
? means matches zero or one time. In other words, if present.

Please do not write in textspeak - you are not limited to 140 characters and people will doubt your literacy.

thank you for your help!!


haha :) ........it's habituated in messenger!!
trying to avoid it......