简体   繁体   中英

Writing html unicode symbols in javascript

How do you write html code in javascript?

I want to write:

document.title = "Title " + (▴); 

where the html code is in parentheses.

Don't do it with the parentheses; that's invalid syntax. Just put it in your string and use the JavaScript Unicode syntax \? :

document.title = "Title \u9652";

Here's a fiddle (note that jsFiddle won't let me change the title, so I change a div's contents instead).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM