Botón Javascript para insertar un gran punto negro (•) en un área de texto html

Tengo un textarea en un parche de 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 carácter.

Gracias por su ayuda!

preguntado el 28 de agosto de 12 a las 13:08

2 Respuestas

Just access the element and append it to the value.

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

Ver una demostración en vivo.

For the sake of keeping things simple, I haven't written JS discreto. 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.

Respondido 28 ago 12, 13:08

@David — The innerHTML propiedad establecerá el tu préstamo estudiantil valor, value establecerá el corriente value. It is the current value that we care about. Don't confuse the value perfecta con el atributo of the same name. - Quentin

Nota la DOM spec for textareas which defines the value property: Represents the current contents of the corresponding form control, in an interactive user agent. Changing this attribute changes the contents of the form control - Quentin

Gracias por sus respuestas chicos. - Brice

you can use html entity as &bull;

respondido 28 nov., 17:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.