admin管理员组文章数量:1288118
Making the selected text bold:
document.execCommand('bold', null, null);
When the user selects that piece of text again (or a part of it), how can you know that it has been made bold?
Bold is just an example. The mandName
could be underline
, heading
, createLink
, ...
Making the selected text bold:
document.execCommand('bold', null, null);
When the user selects that piece of text again (or a part of it), how can you know that it has been made bold?
Bold is just an example. The mandName
could be underline
, heading
, createLink
, ...
2 Answers
Reset to default 13document.queryCommandState
Determines whether the given mand has been executed on the current selection.
Source: http://blog.whatwg/the-road-to-html-5-contenteditable#how
Apparently I didn't search well enough.
You'll know it's bold because it's been wrapped with <b></b>
tags. (or whatever the user-agent uses for bolding text)
本文标签: javascriptHTML5 contentEditable check if format is applied with execCommandStack Overflow
版权声明:本文标题:javascript - HTML5 contentEditable check if format is applied with execCommand? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741337012a2373093.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论