Reputation:
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 after
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?.
Upvotes: 0
Views: 265
Reputation: 1564
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 : http://jsfiddle.net/5u6pnuvr/
Upvotes: 1
Reputation: 4883
:after means child of the selected element, the text of your textarea is not a text node by itself but the value of the textarea node. I think that you should do this with JavaScript instead.
Also, remove the # from the id in your markup, '#' in a CSS selector denotes "id".
Upvotes: 4