Usually textareas are rectangular or square, like this:
But I want a custom-shaped
If, for whatever reason, you really need to support browsers that don't have contenteditable
, you could probably do the same thing in JavaScript, by using events, although this is a very messy workaround.
Pseudocode:
focused=false;
when user clicks the div
{
focused=true;
}
when user clicks outside the div
{
focused=false;
}
when user presses a key
{
if (focused)
{
add character of key to div.innerHTML;
}
}