JSFiddle - React, Tailwind, and code Playground
HTML
<p>Click here, then use tab key to focus textareas without clicking.<BR>Then try clicking.<br>Demonstrates a problem where the etxt does not get selected on focus, and also it seems that the click event is not always firing (in which case focus actually causes the text to be selected).</p><br>
<input type="text" class="automarkup" value="asdfghjgfdsfghhhgf d fd fgf"><br><textarea class="automarkup">Here is some text that should get selected..</textarea><br><p>
sometimes when I click inside a textarea, it only receives the focus event, and sometimes it receives two focus events and one or no click event. I'm on Safari 5.0.5 Mac OSX 10.6.7.
</p>
<div id='igot'></div>
CSS
.automarkup{
width=:200px;height:100px;
}
JavaScript
$(document).ready(function(e) {
$(document).delegate('input.automarkup', 'focus click', function(e) {
var myText = $(this);
var mytxt = myText.text();
//myText.text(mytxt + "\n event fired: " + e.type);
myText.select();
e.stopImmediatePropagation();
$('#igot').text(mytxt+e.type);
return false;
});
});