我的页面上有多个 div。我只想将选定的文本从 div1 复制到 div2。不应复制 div2、div3、div4 上的选择。如果按下 ctrl+A 或一次选择多个 div,则不应发生复制。
//Validation for including text only from specified div
$('#DocumentText').mouseup(function (e) {
debugger;
isSelected = true;
flaginclude = 1;
// e.stopPropagation();
});
$(document).mouseup(function (e) {
debugger;
if (flaginclude != 1) {
e.stopImmediatePropagation();
isSelected = false;
}
flaginclude = 0;
});
myfunction()
{
if(isSelected)
{
//logic to append selected text on div2
}
}