I'm trying to create a button linked to a text field that will let me select all the text in a textarea so the user can copy it to the clipboard. I've tried this:
$('#selectCode').click(function() {
var input = $('#MyTextBox');
input.focus();
input.select();
});
based on several examples I found online where you focus on the input and then select it. But this doesn't seem to work in jQuery -- at least the way I'm doing it. Can someone help?
$("#MyTextBox");todocument.getElementById('MyTextBox');