Jump to content

Need to replace ' and " and all html entities... I cant :(


Monkuar

Recommended Posts

var str = document.REPLIER.Post.value='{$ibforums->input['Post']}';
document.REPLIER.Post.value = str.replace(/<br\s*[\/]?>/gi, "\\n");

 

Okay this above code works very nice, it replaces all the <br>'s with \\n so when people press "enter" it doesn't show the whole form with <Br>'s

 

But I want to make it so so if somone enter's a

 

'

 

OR

 

"

 

OR any other html char, that is converts it back to the same the thing I entered.. instead of "#&39;" or whatever...

 

 

Example:

If I click on Preview Post, it passes through server side ofc to check my bbcode parser, but then it spits the "#&39;" back at me in my editing field which is my code I showed you above! I already converted it so it show's \n instead of <br>'s so it's nice. but now I want to convert the #&39; back to " ' " or any other entity back to it's original character

 

prev1cu.png

preview2c.png

 

 

EDIT(Yes I do check my inputs server side, for html tags/etc, but since the editor is client side it converts them back to the #&39; stuff which I need to be converted back to the original state of the character.

 

Please help, (Hell even if jquery can do this I am down)..

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.