How could I get the selected text in the following code ?
I working with Firefox 3.6.3 (currently not interested in other browsers).
HTML:
<input id="my_text_field" type="text" />
<div id="log"></div>
JavaScript:
$("#my_text_field").select(function() {
var selected_text = "Something selected"; // What should be here ?
$("#log").append(selected_text + "<br />");
});