我使用CKEDITOR的Javascript CKEDITOR獲取鼠標點擊位置
查看:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="~/Content/ckeditor/ckeditor.js"></script>
<input id="insertPattern" type="button" value="insert pattern" />
@Html.TextArea("editor", new { @class = "ckeditor", id = "aboutme" })
的Javascript:
$(function() {
$('input#insertPattern').click(function() {
var txtarea = document.getElementById("aboutme");
var selection = txtarea.getSelection().getStartElement().getOuterHtml();
alert(selection);
}});
如果我點擊布頓,我不能警報選擇在Ckeditor中的Html.TextArea中單擊鼠標的次數。
錯誤:
JavaScript代碼
var selection = txtarea.getSelection().getStartElement().getOuterHtml();
我得到以下錯誤的這一部分,
遺漏的類型錯誤未定義是不是一個函數
在哪裏我錯過?我如何獲得鼠標點擊的選擇?
謝謝這是解決方案:))) – user3722851