Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Brainx7   Members   -  Reputation: 116

Like
0Likes
Like

Posted 30 June 2014 - 10:32 AM

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



Sponsor:

#2 fastcall22   Crossbones+   -  Reputation: 4346

Like
0Likes
Like

Posted 30 June 2014 - 11:11 AM

Detach is what you're looking for.

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

#3 DiegoSLTS   Members   -  Reputation: 1437

Like
0Likes
Like

Posted 30 June 2014 - 11:25 AM

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.


Edited by DiegoSLTS, 30 June 2014 - 11:26 AM.


#4 Brainx7   Members   -  Reputation: 116

Like
0Likes
Like

Posted 30 June 2014 - 12:46 PM

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



#5 fastcall22   Crossbones+   -  Reputation: 4346

Like
2Likes
Like

Posted 30 June 2014 - 12:56 PM

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

.
.
.

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


I, um... wat.

ಠ__ಠ

Edited by fastcall22, 30 June 2014 - 12:56 PM.

c3RhdGljIGNoYXIgeW91cl9tb21bMVVMTCA8PCA2NF07CnNwcmludGYoeW91cl9tb20sICJpcyBmYXQiKTs=

#6 Brainx7   Members   -  Reputation: 116

Like
0Likes
Like

Posted 30 June 2014 - 03:02 PM

 

$('.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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS