【发布时间】:2012-09-26 13:11:42
【问题描述】:
我有以下代码将所选文本包装在 H2 标记中。
问题是,它只适用于 Firefox(虽然我还没有在 IE 中测试过)。它不适用于 Safari 或 Chrome。
是我遗漏了什么还是这个功能不兼容所有浏览器?
<button onclick="document.execCommand('heading',false,'h2');">heading</button>
<div class="editable" contentEditable>
<p>Add content here...</p>
</div>
【问题讨论】:
标签: html contenteditable execcommand html-heading