4
How to print html code ?
Example:
<div id="css"><link rel="stylesheet" href="jquery.css.css"></div>
it does not print the link tag, it links another css, want to write this tag pro user read...
4
How to print html code ?
Example:
<div id="css"><link rel="stylesheet" href="jquery.css.css"></div>
it does not print the link tag, it links another css, want to write this tag pro user read...
5
Use <
instead of <
, and >
instead of >
.
5
To do this you need to escape some special characters**
, for example:
" para "
' para '
& para &
< para <
> para >
To facilitate you can use the function htmlentities
.
The code:
<div id="css"><link rel="stylesheet" href="jquery.css.css"></div>
Equates:
<div id="css"><link rel="stylesheet"href="jquery.css.css"></div>
**
Others may be seen here.
1
You can print special characters in HTML using HTML Entities.
If you want you can use this converter here.
Server languages - like PHP, Ruby, Python - have their own functions to convert one string into another with encoded characters.
When you will print any text that was entered by the user (such as a blog post, for example) it is recommended to use this function to prevent attacks from Javascript Injection. In this type of attack someone malicious can write tags script
that will run on the user’s machine without their consent.
Browser other questions tagged html html5
You are not signed in. Login or sign up in order to post.
It is not clear in your question whether you want to do this on the client side (javascript) or server side (php for example). I leave a related link: http://answall.com/a/11058/129
– Sergio