duanbing2963 2014-02-12 00:31
浏览 49
已采纳

一旦选中一个类,jQuery禁用复选框

So I have some php code that is spitting out checkboxes for Avatar. However the person can only select one of the images in their gallery to be their avatar. However When they check one of the boxes I want to be able to disable all the others. I can't seem to figure this out. Tried many different things so I thought I would ask with specific code.

echo 'Avatar: <input type="checkbox" name="membersview[]" class="memberavatar" value="'.$galleryid.'" /><br />';

So what I want is if a user checks any checkbox that has a class of members avatar. I would like to disable the other checkboxes that have the class of membersavatar.

Some Sample HTML output so you can see how it is being renedered by the browser

<form action="/members/members_gallery.php" method="post" id="memberdetail">
<div style="width:150px; height:200px; float:left; margin:0; padding:0; border:0;">
    <a href="../site/images/gallery/users/ninja@theringersclan.com/1390202957-20130816_193346.jpg" target="_blank">
        <img src="../site/images/gallery/users/ninja@theringersclan.com/1390202957-20130816_193346.jpg" style="width:150px; height:150px; margin:0; border:0; padding:0;">
    </a> 
    <br>Is Public: <input type="checkbox" name="galleryid[]" value="5">
    <br>Members: <input type="checkbox" name="membersview[]" value="5" checked="checked">
    <br>Avatar: <input type="checkbox" name="membersview[]" class="memberavatar" value="5">
    <br>Delete: <input type="checkbox" name="deletepic[]" value="5">
    <br>
</div>
<div style="width:150px; height:200px; float:left; margin:0; padding:0; border:0;">
    <a href="../site/images/gallery/users/ninja@theringersclan.com/1390203939-240_screenshots_2014-01-19_00001.jpg" target="_blank">
        <img src="../site/images/gallery/users/ninja@theringersclan.com/1390203939-240_screenshots_2014-01-19_00001.jpg" style="width:150px; height:150px; margin:0; border:0; padding:0;">
    </a>
    <br>Is Public: <input type="checkbox" name="galleryid[]" value="7" checked="checked">
    <br>Members: <input type="checkbox" name="membersview[]" value="7" checked="checked">
    <br>Avatar: <input type="checkbox" name="membersview[]" class="memberavatar" value="7">
    <br>Delete: <input type="checkbox" name="deletepic[]" value="7"><br></div><div class="cl">
</div>
<br><br>
<input type="submit" name="galleryupdatepics" value="Update Pics" style="float:left">

  • 写回答

4条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥20 有人知道怎么将vsi格式的图片文件,转换为svs格式的文件吗
      • ¥15 历史模拟法计算var实验报告
      • ¥15 白鲸算法优化K值的VMD分解出错
      • ¥20 写一个基于52单片机用hc-05蓝牙模块控制28BYJ-48步进电机进行旋转,在手机蓝牙串口输入1019电机转半圈,输入2038电机转一圈,输入0复位的代码吗
      • ¥15 求51单片机8位数码管计时器程序
      • ¥20 matlab识别螺母边缘
      • ¥15 python 6x6游戏加登录、记录系统
      • ¥100 基于做一个模拟智慧路灯
      • ¥15 ME21N 创建采购成功并且生成采购订单号,但显示“快件文档更新已取消”,SM13看错误提示为如下截图:
      • ¥30 android 集成fmod实现变声功能中遇到的问题