Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 545
Brice Avatar asked Jun 01 '26 12:06

Brice


1 Answers

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.

like image 163
Quentin Avatar answered Jun 04 '26 02:06

Quentin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!