如何在界面上获得选中的文本内容

 

 

var selection = window.getSelection();
var selText = selection.toString()

 

var selection = document.getSelection();
var selText = selection.toString()

 

 

你可能感兴趣的:(html,selection)