2013-01-11 3 views

답변

-1

시도

function getSelected() { 
var text = ""; 
if (window.getSelection && window.getSelection().toString() && $(window.getSelection()).attr('type') != "Caret") { 
    text = window.getSelection(); 
    return text; 
} else if (document.getSelection && document.getSelection().toString() && $(document.getSelection()).attr('type') != "Caret") { 
    text = document.getSelection(); 
    return text; 
} else { 
    var selection = document.selection && document.selection.createRange(); 
    if (!(typeof selection === "undefined") && selection.text && selection.text.toString()) { 
     text = selection.text; 
     return text; 
    } 
} 
return false; 
} 
관련 문제