function getInputSelection(elem){
if(typeof elem != "undefined"){
s=elem[0].selectionStart;
e=elem[0].selectionEnd;
return elem.val().substring(s, e);
}else{
return '';
}
}
$(function() {
$("#btnText").click(function() {
alert(getInputSelection($("#textareaLSG")));
});
});
No hay comentarios:
Publicar un comentario