解决方案 »

  1.   

    $('#test input[type=checkbox]').each(function(){console.log(this)})
      

  2.   

    不行,没有效果。"test"这个DIV 是用$("#test").append(json); 加载进去的。
      

  3.   

    <script type="text/javascript">
            $(document).ready(function() {
                $("#select").click(function() {
                    var startdate = $("#startdate").datebox('getValue');
                    var endate = $("#enddate").datebox('getValue')
                    $.ajax({
                        type: "post",
                        dataType: "html",
                        url: "../Service/WebService.ashx?Method=GetMealCalendHtml",
                        data: { startDate: startdate, endDate: endate },
                        success: function(json) {
                            $("#calendaPanel").empty();
                            $("#calendaPanel").append(json);
                        }
                    });
                });
            });
            function Oncheck(mealdata) {
                $("#" + mealdata.id + " input[type=checkbox]").each(function() { console.log(this) });
            }  
        </script>
      

  4.   

    <table border='0' cellpadding='3' cellspacing='1' align='center' style='background-color: #b9d8f3;'>    
    <tr class='thstyle' id='weekrow'>
            <td >Wednesday</td>        
            <td >Thursday</td>        
            <td >Friday</td>        
            <td >Saturday</td>        
            <td >Sunday</td>        
            <td >Monday</td>        
            <td >Tuesday</td>    
    </tr>    
    <tr>
            <td>            
            <div class='dayTD'>2014-10-1</div>            
            <div class='meallist'>            
            <label for='1,1,br'>早</label>
            <input type='checkbox' value='早' id='1,1,br' /><br />        
            <label for='1,1,lh'>中</label>                  
            <input type='checkbox' value='中' id='1,1,lh'  /><br />   
            <label for='1,1,dn'>晚</label>                
            <input type='checkbox' value='晚' id='1,1,dn' disabled='True'/>            
            </div>        </td>        <td>            
            <div class='dayTD'>2014-10-2</div>           
            <div class='meallist' id="test">            
            <label for='1,2,br'>早</label>                
            <input type='checkbox' value='早' id='1,2,br' checked="checked"  onclick="Oncheck(this.parentNode)" /><br />
            <label for='1,2,lh'>中</label>                  
            <input type='checkbox' value='中' id='1,2,lh' checked="checked"onclick="Oncheck(this.parentNode)"/><br />            
            <label for='1,2,dn'>晚</label>                
            <input type='checkbox' value='晚' id='1,2,dn' checked="true" onclick="Oncheck(this.parentNode)" />            
            </div>        
            </td>  
         </tr>
    </table>  只是 上面ajax返回的“json”数据
      

  5.   


    function Oncheck(mealdata) {
                mealdata.find('input[type=checkbox]").each(function() { console.log(this) });
            }  
    <input type='checkbox' value='晚' id='1,2,dn' checked="true" onclick="Oncheck($(this).parent())" />      
      

  6.   


    $('#test input[type=checkbox]').on("click",function(){
           $('#test input[type=checkbox]').each(function() {
                    console.log($(this).index());
           });
    })