Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Automatically Select-All When Clicking On A Content Editable Element

Overview

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.

Example HTML

Here's the example along with the HTML that makes it

Draw the chart
Fasten two pins

The Script

And this is the function that makes things happen:

References