how to show()/remove() a textarea with jquery

Started by
4 comments, last by Brainx7 9 years, 9 months ago

I found this code http://jsfiddle.net/uhv5R/5/ which shows and hides with a selection but I want to remove it instead of hiding it when select is no. I used the function remove() for this but when I choose yes again it wont show it again, is like once you choose remove thats it its gone. Ho could I do this

Advertisement
Detach is what you're looking for.

You should be using show/hide because DOM operations can be expensive.

So, you want to "remove instead of hiding", but then you want to show it again? If you want to show it again then hiding it makes much more sense.

I solved it http://jsfiddle.net/dnwTV/126/


$('.Option > textarea:last').last().remove();

.
.
.

$('<textarea ></textarea>').fadeIn('fast').appendTo('.Option');


I, um... wat.

?__?


$('.Option > textarea:last').last().remove();

.
.
.

$('<textarea ></textarea>').fadeIn('fast').appendTo('.Option');

I, um... wat.

?__?

lol the original fiddle was different I made a couple of changes, if that's what you are implying

This topic is closed to new replies.

Advertisement