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: 136

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



#2 fastcall22   Crossbones+   -  Reputation: 9058

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.

gzip: H4sIAAAAAAAEAG1QTUvEMBC991e8nvaiFfYoS7yo sLCo6MnjtJ1ugmkiyWRL/72z3T1YEQIJ8z4zA2Xp yPvt1qBpGrRFIJZkk9FyRyUzHCbKIHgn4hnZOrm1 TD0mG0HCCs+QGDGWziKXI6Wm2n++GYwUVH2mrGEE PnGCVQ8K8+JYfXA6URDEQfMZh5h6g5eoAlWJdeEI bbH2qYZf7XMUfw8f/Q0oMeZYNL9/WHF0uFEshvMr XYujd9SycFb+F18QcSOvlJauZ8ejqevdnV7/d550 e0t6prmunh73Bu+vz4c/XUeOQXfJgvKNkhf95U8/ Dtgmy5IBAAA=


#3 DiegoSLTS   Members   -  Reputation: 2113

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: 136

Like
0Likes
Like

Posted 30 June 2014 - 12:46 PM

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



#5 fastcall22   Crossbones+   -  Reputation: 9058

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.

gzip: H4sIAAAAAAAEAG1QTUvEMBC991e8nvaiFfYoS7yo sLCo6MnjtJ1ugmkiyWRL/72z3T1YEQIJ8z4zA2Xp yPvt1qBpGrRFIJZkk9FyRyUzHCbKIHgn4hnZOrm1 TD0mG0HCCs+QGDGWziKXI6Wm2n++GYwUVH2mrGEE PnGCVQ8K8+JYfXA6URDEQfMZh5h6g5eoAlWJdeEI bbH2qYZf7XMUfw8f/Q0oMeZYNL9/WHF0uFEshvMr XYujd9SycFb+F18QcSOvlJauZ8ejqevdnV7/d550 e0t6prmunh73Bu+vz4c/XUeOQXfJgvKNkhf95U8/ Dtgmy5IBAAA=


#6 Brainx7   Members   -  Reputation: 136

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