You can encode the <
and >
to their HTML equivelant.
html = html.replace(/</g, "<").replace(/>/g, ">");
More Related Contents:
- Invoking JavaScript code in an iframe from the parent page
- Capture HTML Canvas as gif/jpg/png/pdf?
- Adjust width and height of iframe to fit with content in it
- How to get numeric value from a prompt box? [duplicate]
- How to set value of input text using jQuery
- How do I get the information from a meta tag with JavaScript?
- getElementById() returns null even though the element exists [duplicate]
- How to display JavaScript variables in a HTML page without document.write
- Text blinking jQuery
- How to mute all sound in a page with JS?
- How to resize html canvas element?
- Opening new window in HTML for target=”_blank”
- Nesting quotes in JavaScript/HTML
- How to display div after click the button in Javascript? [duplicate]
- Looping through files for FileReader, output always contains last value from loop
- HTML5 callbacks?
- Dark mode flickers a white background for a millisecond on reload
- How to save canvas animation as gif or webm?
- getElementsByClassName() with two classes
- Attribute onclick=”function()” not functioning as intended?
- Sorting a list by data-attribute
- How to trigger CSS “hover state” using Javascript? [duplicate]
- Check if a file exists locally using JavaScript only
- Is there an equivalent of canvas’s toDataURL method for SVG? [closed]
- Rotate div text after clicking on button using jquery and css
- How much data / information can we save / store in a QR code?
- html5/Javascript – How to get the Selected folder name?
- Do duplicate ID values screw up jQuery selectors?
- Split text into pages and present separately (HTML5)
- Can you have multiple lines in an element?