Mongodb Mongodb - 9 months ago 30
CSS Question

Inserting some text in textarea using css

In an app i am making i need to show a signature in every message i post using a textarea.I have tried appending some text using this code with no success.I have tried using the css pseudo-element


This is my textarea and css code

<textarea id="#le_message_compose" placeholder="type your message here"></textarea>

#le_message_compose:after {
color: #708090;
content:'this is my text' !important;

but this does not produce the desired effect. How should i have some text displayed inside a textarea?.


You might want to check the answer here: Can a ::before selector be used with a <textarea>?

looks like you cant use the :before and :after on elements that don't contain other elements (eg img or textarea)

I also noticed in your html markup that the id is '#le_message_compose' it should probably be just 'le_message_compose', but in any case I think what you are trying is not going to work.

You could use jQuery though:

$('#le_message_compose').html('my message in here');

Here is a fiddle with the jQuery way :