views:

608

answers:

1

I have 4 check box when i select anyone of the check box need to display the respective check box and text box.

input type="checkbox" id="acheck[]" value='name'

input type="textbox" id="productfield" value=' '

jquery Code:

                          $(document).ready(function() {


                            $("#productfield").css("display","none");

                            $("#acheck").click(function(){

                                    if ($("#acheck").is(":checked"))
                                    {

                                        $("#productfield").fadeIn("slow");
                                    }
                                    else
                                    {     

                                        $("#productfield").fadeOut("slow");
                                    }       

                          });

                    });
+1  A: 

It's not clear from the question, but I guess you want something to appear when you click the checkbox? This should get you started.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
<html>
<head>
  <style>
    #appear_div { display: none; }
  </style>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
  <script>
    $(document).ready(function() {
      $('#appear').click(function() { $('#appear_div').show(); });
    });
  </script>
</head>
<body>
  <input type="checkbox" id="appear">
  <div id="appear_div">
  <input type="checkbox" id="cb1">Check me <input type="text" id="text1">
  </div>
</body>
</html>
Mr. Shiny and New