2009-07-14 92 views
-6

我有4复选框,当我选择任何一个复选框需要显示相应的复选框和文本框。Jquery - 复选框和多个文本框

INPUT TYPE = “复选框” ID = “A检查[]” 值= '名称'

INPUT TYPE = “文本” ID = “productfield” 值=”'

jQuery代码:

$(document).ready(function() { 


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

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

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

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

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

     }); 

}); 
+3

你应该更清楚自己真正想要做的 – jitter 2009-07-14 11:42:43

回答

1

这个问题并不清楚,但我想你想在点击复选框时显示一些内容?这应该让你开始。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<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"></script> 
    <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>