0
使用window.getSelection()
工作正常的文本高亮顯示。但是,當我想突出顯示預選保存的文本不起作用。請幫我解決這個問題。向execcommand應用addclass方法
var highlight = 'Hello There';
document.execCommand('formatblock', false, 'p')
var listId = highlight.focusNode.parentNode; // window.getSelection() not used
$(listId).addClass("customClass");
''highlight'是_string_的插件。 'getSelection'不返回一個字符串。它返回一個[Selection](https://developer.mozilla.org/en-US/docs/Web/API/Selection)對象。 – undefined 2014-11-08 13:20:42