I'm working on a tool to make ascii art. One feature I'm after is the ability to auto select a character when I click on it. This is the code I'm using for that.
Here's the example along with the HTML that makes it
And this is the function that makes things happen:
If you click on the _Draw the chart__ or _Fasten two pins__ lines in the Example section you'll see the behavior
I tested this on a mac in safari, firefox, and chrome
The main thing is the _focusOnClick__ handler. I'm attaching them through the _init__ function. Other methods would work just as well