Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,
How to show angel brackets in firefox, Tag are showing properly in IE, Chorme, Safari
But problem is coming in FireFox.

I want show the data like <manage> then how can i show this in FireFox?

Everything is working fine in IE, Chorme, Safari.

<What angle brackets? — SA :-)>
Posted
Updated 28-Sep-13 4:04am
v2
Comments
OriginalGriff 28-Sep-13 9:26am    
Do you have an example of what you are trying to display, and how you are currently showing them?
Because without that, we have to guess what method you might be using, and then guess again what problem that might be causing.
Use the "Improve question" widget to edit your question and provide better information.

"I wanted to show html tag in my asp.net form like if user type or <bracket> then it shuld there as it is. Tags are showing properly in IE chrome but not is Firefox. Is there special way to show?"

Yes - you have to do what is called HTML Encoding: if changes < to &lt; and the latter then displays as the former! :laugh:

It's a bit of a PITA in javascript, but it is possible:
See here: http://stackoverflow.com/questions/1219860/html-encoding-in-javascript-jquery[^]
Which gave me this:
JavaScript
function htmlEscape(str) {
    return String(str)
            .replace(/&/g, '&amp;')
            .replace(/"/g, '&quot;')
            .replace(/'/g, '&#39;')
            .replace(/</g, '&lt;')
            .replace(/>/g, '&gt;');
}

function htmlUnescape(value){
    return String(value)
        .replace(/&quot;/g, '"')
        .replace(/&#39;/g, "'")
        .replace(/&lt;/g, '<')
        .replace(/&gt;/g, '>')
        .replace(/&amp;/g, '&');
}
 
Share this answer
 
How about the brackets I added to the text of your question? Are they angelic enough (in Firefox)? :-)

To take a close look, click Improve question.

Did you try something else?

—SA
 
Share this answer
 
Comments
amit_83 30-Sep-13 0:19am    
Got the solution. I was setting the label value from javascript.
firefox use textContent property to set the value.
Sergey Alexandrovich Kryukov 30-Sep-13 10:05am    
What's the difference if you type it or output with JavaScript?
All you need it the character references:
http://www.w3.org/TR/html4/sgml/entities.html.
Will you accept the answer formally then?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900