Botón Javascript para insertar un gran punto negro (•) en un área de texto html
Frecuentes
Visto 113,514 veces
1
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!
2 Respuestas
5
Just access the element and append it to the value.
<input
type="button"
onclick="document.getElementById('myTextArea').value += '•'"
value="Add •">
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
5
you can use html entity as •
respondido 28 nov., 17:07
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas javascript utf-8 textarea special-characters text-editor or haz tu propia pregunta.
formato de archivo.info/info/unicode/char/2022/index.htm - jbabey