Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery fadeout text insde a text box and textarea

Tags:

jquery

fadeout

Hi this should be a really easy problem but i am stuck. Is it possible to fade out the text inside a text box and textarea and leave the actual element in place. I have tried fading out using .html() .val() etc but the element that the text is in is always faded too.

like image 884
David Avatar asked Feb 19 '10 14:02

David


2 Answers

I think the only way to achieve this is by manipulating the input element's colour. Check out the JQuery color plugin that specializes in colour manipulations.

It should work along the lines of

$(formelement).animate({ color: "#FFFFFF" }, 600);
like image 54
Pekka Avatar answered Oct 19 '22 16:10

Pekka


Simply surround the text in a span and fade the span. JQuery will fade the element, this is the easiest way. I am not sure there is a way to fade just text and not the entire DOM element.

Edit: Didn't read the textarea part. To do this you'll probably want to hide the actual input element and style a new one to look like a text element, and then fade the text inside it. This is commonly done to restyle the look of an input element.

like image 23
Jeremy B. Avatar answered Oct 19 '22 17:10

Jeremy B.