3
나는 다음과 같은 DIV있다. 그 때문에 나는 다음의 ChangeListener이 : 나는 document.execCommand()를 사용하려고선택하지 않고 execCommand를 사용 하시겠습니까? 단어 <strong>굵은</strong>마다 사용자가 입력하게 볼의 나는 특정 금액을 만들고 싶어이 사업부 내부</p> <pre><code><div contenteditable="true" unselectable="off" id="foo"> </code></pre> <p>:
$('#foo').live('focus', function() {
before = $(this).html();
}).live('blur keyup paste', function() {
if (before != $(this).html()) { $(this).trigger('change'); }
});
$('#foo').live('change', function() {
// make certain words bold
document.execCommand ('bold', false, null); // doesn't work
});
을하지만 난 굵은을 할 텍스트를 선택하는 경우에만 작동합니다. 그러나 사용자가 굵게이어야하는 단어를 모르기 때문에 텍스트를 선택하고 싶지 않습니다.
내 테스트에서 실행 취소/다시 실행을 실행 중지합니다. – bumfo