To print special characters like the Copyright symbol © or a Trademark ™ using JavaScript, use escape sequences.
For example, to print the Copyright symbol ©, use this code:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Print Special Characters using JavaScript</title>
</head>
<body>
<div id="divOne" />
<script type="text/javascript">
var str = "Copyright \u00A9 DevCurry.com";
document.getElementById('divOne').innerHTML = str;
</script>
</body>
</html>
Check some more Character Entity References over here. Note that escape sequences in JavaScript begins with a backslash character (\) like \u00A9 and so on.
OUTPUT
Tweet
2 comments:
hihihi
thanks a lot my friend ^^
exactly what i need - thanks!
Post a Comment