我面临着在文本区域中多次选择文本的问题,div被放置在文本区域之外,但对于单个选择单词,它工作正常..
JavaScript的:
$(document).ready(function () {
closePopUp();
var newpost = $('#newpost');
$('#mytextarea').on('select', function (e) {
var txtarea = document.getElementById("mytextarea");
var start = txtarea.selectionStart;
var finish = txtarea.selectionEnd;
newpost.offset(getCursorXY(txtarea, start, 20)).show();
newpost.find('div').text('replace with stars');
});
document.onkeydown = undo;
});
这是我的plunker
问题如下图所示: