我有一个设置为可编辑的div。现在我想在可编辑的div中启用div的大小调整。
在我的示例HTML中,插入工作正常,但如何使插入的HTML div具有可调整大小的功能呢?
代码:
function inserthtml() {
var sel = document.selection;
if (sel) {
var textRange = sel.createRange();
document.execCommand('inserthtml', false, "<div><img src='https://www.google.com/images/srpr/logo11w.png' height='42' width='42'></div>");
textRange.collapse(false);
textRange.select();
} else {
document.execCommand('inserthtml', false, "<div><img src='https://www.google.com/images/srpr/logo11w.png' height='42' width='42'></div>");
}
}
fiddle: http://jsfiddle.net/q6q05f1b/