Brice Brice - 24 days ago 6
Javascript Question

Javascript button to insert a big black dot (•) into a html textarea

I have a

textarea
in a
html form
and I would like to have a button to add a big black dot character (•) (is this called a bullet?) into this
textarea
. is it possible in
javascript
?

Also it needs to be a
UTF8
character.

Thanks for your help!

Answer

Just access the element and append it to the value.

<input
     type="button" 
     onclick="document.getElementById('myTextArea').value += '•'" 
     value="Add •">

See a live demo.

For the sake of keeping things simple, I haven't written unobtrusive JS. For a production system you should.

Also it needs to be a UTF8 character.

Browsers generally submit forms using the encoding they received the page in. Serve your page as UTF-8 if you want UTF-8 data submitted back.