获取已选中和未选中状态的所有复选框的列表

I have following code, to show an image along with its checkbox. It is either enabled or disabled

 if($ring["status"] != '1') 
                                        echo '<td><input type="checkbox" name="ringIds[]" value="'.$ring["id"].'">'
                                    . '<input type="image" onClick="openGalleryRing(\''.$ring['imagePath'].'\', \''.$ring['id'].'\');" src="http://thevowapp.com/iphoneapp/vowstore/rings/'.  $ring['imagePath'] .'" name="checked" value="' . $ring['id'].'" data-my-info="'. $ring['ringSetName'] .'" style="width:200px; height:200px; margin-left: 10px;"></td>';
                                    else                                         
                                         echo '<td><input type="checkbox" checked="checked"  name="ringIds[]" value="'.$ring["id"].'">'
                                    . '<input type="image" onClick="openGalleryRing(\''.$ring['imagePath'].'\', \''.$ring['id'].'\');" src="http://thevowapp.com/iphoneapp/vowstore/rings/'.  $ring['imagePath'] .'" name="checked" value="' . $ring['id'].'" data-my-info="'. $ring['ringSetName'] .'" style="width:200px; height:200px; margin-left: 10px;"></td>';

In my javascript i am using something like

$('.updateBtn').on('click', function()
        {
             var checked = $('input[name="ringIds[]"]:checked').serialize(); 
             if(checked !== '')
                 window.location.href = 'actions.php?j=24&' + checked;
             else
                 alert('No Rings are selected');
    }); 

This works, i can get all the checked checkboxes, but what i actually want is to get all hte list of checkboxes, which are checked and which are not. How can i modify this code?

查看全部
doujiang3997
doujiang3997
2015/06/02 04:02
  • php
  • html
  • javascript
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复