Web Analytics Made Easy -
StatCounter independently show/hide - CodingForum

Announcement

Collapse
No announcement yet.

independently show/hide

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • independently show/hide

    I have a checkbox that when checked I'd like to show a hidden textarea... I've been trying a number of different things and it either doesn't work at all or if I select one it shows all the text boxes on the page INSTEAD of the specific one that was selected.

    Can someone explain to me in detail how this process works? I have some working code that I've done pretty much the same thing. Click a div and show a table...click it again and it hides... I look at these two bits of code and I have no idea why one works and the other doesn't... I'm just trying to figure this out and learn a little at the same time. Help is appreciated!!

    this is my non-working code.... .check_msg is the checkbox, .msg is the textarea
    Code:
    $('.check_msg').click(function(){
        if (this.checked) {
    	$(".msg").show("slow");    
        }
        else{
        	$(".msg").hide("slow");    
        }
    })
    when checked or unchecked it applies it to all the textareas... I just want the one selected to show the according textarea...

    here's my other working code... (i tried to copy this same code and change the classes and it will not work)

    Code:
       $(".show_story").click(function () {
    		$(this).next(".outer_table").slideToggle("slow");    
        });
    
    
     $(".show_story1").click(function () {
    		$(this).next(".outer_table1").slideToggle("slow");    
        });

  • #2
    We need your HTML for this. Otherwise we won't know where the textarea is relative to your checkbox.

    Btw there is no such thing like "a selected textarea" in general. This is just your semantics. So your code has to take care to address the correct textarea as soon as a checkbox is being checked.

    Comment

    Working...
    X