开发者

Does the HTML 'ID' tag allow UTF-8 encoded characters?

What I mean is开发者_如何学C, is it valid to have html tag like this

<div id="t_реклама">Some text</div>

And second question, if this is not legal, then would the urlencoded version (like percent-encoded) value be allowed?

Also, will Javascript have problem parsing value of utf-8 id?


I don't think this is allowed:

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

http://www.w3.org/TR/html401/types.html#type-name


I'm guessing the reason you want to do this is to store some information in the HTML to retrieve later.

If that's the case, try using a custom HTML attribute:

<div id="myDiv" data-myattribute="t_реклама"></div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜