views:

59

answers:

3

So I want to show image thumbnails too in the <textarea> along with text. If you know a javascript solution that's perfect too(if possible in vanilla JS).

Like this:

__________________
|Hello World     |
|  _______       |
|  | Img |       |
|  |     |       |
|  |_____|       |
|Hello again.    |
|  _______       |
|  | Img2|       |
|  |     |       |
|  |_____|       |
|________________|

As I know and seen in a div or anything what has contentEditable="true" allows image too but, allows many other HTML tags and a lots of things what I don't want :|

I want just text and images.

A: 

you can use css to set an background image for textarea, and js to set the text

yangqi
I don't want a background for the textarea, I want to have images inside the textarea. Or do you mean to hack the textarea with a background so it would look like there is an image inside the textarea? If yes then that's not a good idea because there will be multiple images, and can be updated and deleted too. Edited my question to illustrate it.
CIRK
As far as I know, you can't use images in a textarea, neither a background-image set with CSS nor an img element.
matsolof
I don't know what you wanna do, but you can insert anything but plain text inside the textarea. While you do can use CSS to set a background image for an textarea, if you wanna change it, you can then use javascript to change the background.
yangqi
A: 

The short answer is no, it's not possible, sorry.

thomasmalt
Thanks for you answer @thomasmalt , then what do you suggest how should I do it?
CIRK
I'm not sure what you're trying to achieve. Do you want to use textarea with images to display your content to the user, or do you want to use textarea in a form where the user provides text and uploads images?
thomasmalt
+2  A: 

I understand you want to edit text and pictures but... why does it have to be inside a textarea? Such control is designed to hold plain text. There're many HTML editors written in JavaScript:

Álvaro G. Vicario
Because I don't want to build a complex editor, as I said I want just `text` and `photos`.
CIRK