I'm getting an undefined is not a function
error when I try and run the following code:
$(document).ready(function() {
$("#textarea").select(function() {
var selection = window.getSelection();
$("#upper").click(function() {
// alert(selection);
var upper = selection.toUpperCase();
var text = $("#textarea").text();
$("#textarea").html(text.replace(selection, upper));
});
});
});
I'm trying to select text from a textarea, and click a button to make the selection uppercase. Here is a JSFiddle of the complete code.