tag
I use the tag in my blog to post code. I know I have to change
<
to <
and >
to >
tagThis is not well known, but it really does exist and even chrome still supports it,
however using pair
tag is NOT recommended to be relied on - it's just for you, but its a very simple way how to do your personal e.g. DOCS. even w3.org WIKI says in example "No, really. don't use it."
You can put ANY html (excluding end tag) inside
just any other html tags...
Proper version could be considered a HTML stored as STRING and displayed with the help of some escaping function.
Just remember one thing - the strings in C-like languages are ususally written between single quotes or double quotes - if you wrap your string in double => you should escape doubles (problably with \
), if you wrap your string in single => escape singles (probably with \
)...
Server-side scripting languages often have some built-in function to escape HTML.
or just any other HTML"; //store html
echo htmlspecialchars($html); //display escaped html
?>
Similar approach as on server-side is achievable in client-side scripts,
JavaScript, from what I know, has no built-in function for that (it's quite logical), but if you use some framework/library, like jQuery - there are functions that can be used that way.
Just remember the same thing as for server-side - in C-like languages, escape the quotes you've wrapped your string in...
var html = '
or just any other HTML';
var $elementToInsertEscapedHTMLto = jQuery("XXX"); //XXX is selector, e.g. CSS selector
$elementToInsertEscapedHTMLto.text( html );