Need Pure/jQuery Javascript Solution For Cleaning Word HTML From Text Area -


I know that this issue has been touched here, but I still have not found a viable solution to my situation , So I want but to rely on the brain to work back and see what can be done.

I have a text in which something has been pasted in it, and any hidden HTML & amp; Quotation mark. The content of this form is being emailed to a third party system which is specially showered, so sometimes it is not a safe bet to encode the characters of the HTML unit.

I can not use anything unfortunately like FCKEditor, TinyMCE, etc., it will be a regular textarea in this example. I have tried to piece out the FCKEditor's paste from the word function, but it does not keep track of luck.

Although I need to be needed, but I'm able to use the Java library, but no jQuery plugins have been found for this yet.

I have been specifically designed to clear information stuck in information, not how to monitor the element of change of material.

Any creative help would be greatly appreciated.

I am looking at the answer of David Archer and he gives a lot of answers. I have used a solution in my past:

  $ ("textarea"). Change (function () {// Convert any opening and closing brace in your HTML encoded counterpart. StrClean = $ (this) .val (). Replace (/ & lt; / gi, '& amp; lt; 'Replace' (/>, / gi, '& amp; gt;'); // Remove any double and single quotation marks. StrClean = strClean.replace (/ "/ gi, '') .replace ( / '/ Gi,' '); // data back to $ (this) .val (strClean);});  

If you completely delete the HTML tag Looking for

  $ ("textarea"). Change (function () {// completely strips tag. Vert strClean = $ (this) .val (). Replace (/ & lt; / [^ & gt;] + & gt; / gi, ''); // Any Double and Single Remove quotation marks. StrClean = strClean.replace (/ "/ gi, '') .replace (/ '/ gi,' '); // data back in $ (this) .val (strClean);});  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -