Jump to content

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


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)..

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.