doujiang3997 2015-06-02 04:02
浏览 122
已采纳

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

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?

  • 写回答

2条回答 默认 最新

查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 链接问题 C++LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接