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   Members   

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   Moderators   

9742
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.
zlib: eJzVVLsSAiEQ6/1qCwoK i7PxA/2S2zMOZljYB1TO ZG7OhUtiduH9egZQCJH9 KcJyo4Wq9t0/RXkKmjx+ cgU4FIMWHhKCU+o/Nx2R LEPgQWLtnfcErbiEl0u4 0UrMghhZewgYcptoEF42 YMj+Z1kg+bVvqxhyo17h nUf+h4b2W4bR4XO01TJ7 qFNzA7jjbxyL71Avh6Tv odnFk4hnxxAf4w6496Kd OgH7/RxC

#3   Members   

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   Members   

136
Like
0Likes
Like

Posted 30 June 2014 - 12:46 PM

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



#5   Moderators   

9742
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.

zlib: eJzVVLsSAiEQ6/1qCwoK i7PxA/2S2zMOZljYB1TO ZG7OhUtiduH9egZQCJH9 KcJyo4Wq9t0/RXkKmjx+ cgU4FIMWHhKCU+o/Nx2R LEPgQWLtnfcErbiEl0u4 0UrMghhZewgYcptoEF42 YMj+Z1kg+bVvqxhyo17h nUf+h4b2W4bR4XO01TJ7 qFNzA7jjbxyL71Avh6Tv odnFk4hnxxAf4w6496Kd OgH7/RxC

#6   Members   

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.