0

Load HTML content in text box

asked 2014-06-06 12:54:16 +0800

Ashutosh gravatar image Ashutosh
1

I have one textbox. This textbox is of multiple lines. In java i have one string which hold data to show in HTML format. How can load that content in textbox without showing HTML tags.

Is there any way to do this ??

Thanks in advance.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-06-06 16:52:58 +0800

cyiannoulis gravatar image cyiannoulis
1201 10

You mean something like this?

<?page title="" contentType="text/html;charset=UTF-8"?>
<zk>

<script type="text/javascript"><![CDATA[

    function removeHTMLTags() {
        var strInputCode = $("$txtInput").val(); 
        strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
                return (p1 == "lt")? "<" : ">";
        });
        var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
        $("$txtOutput").val(strTagStrippedText);
    }

]]></script>

<window title="" border="none">

    <vlayout>
        <textbox id="txtInput" multiline="true" rows="10" width="500px" height="200px" 
                placeholder="Place here the HTML code" 
                onChanging='Clients.evalJavaScript("removeHTMLTags();")' />         

        <textbox id="txtOutput" multiline="true" rows="10" width="500px" height="200px" 
                placeholder="Output result" />
    </vlayout>

</window>
</zk>

Hope that helps, Costas

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-06-06 12:54:16 +0800

Seen: 47 times

Last updated: Jun 06 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More