如何将复选框 id 传递给模态框? [英] How to pass checkbox id to the modal box?

查看:24
本文介绍了如何将复选框 id 传递给模态框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
如何在模态框中勾选 id?

我有一个表格,每行都有一个复选框和一个按钮.每当按下按钮时,都会出现一个模式框,同时复选框也会被选中.

I have a table which each row have a checkbox and a button. whenever the button is pressed, a modal box will appear and at the same time the checkbox will get checked as well.

模式框会询问用户是否要删除特定记录.如果是,表格将被提交.如果否,复选框将被取消选中.

The modal box will as ask user if want to delete particular record. If Yes, the form will be submitted. If No, the checkbox will be unchecked.

我遇到了取消选中复选框的问题.任何人都可以帮助提供示例代码吗?如何将复选框 id 传递给模态框,以便取消选中该特定复选框?

I am facing issue with getting the checkbox unchecked. Anyone can assist with sample code? How do I pass the checkbox id to the modal box so that that particular checkbox can be unchecked?

谢谢.

         var buttons3 = $("#yns button").click(function(e) { 
        // get user input
         var yes = buttons3.index(this) === 0;
         if (yes){
         $('form#form1').submit();
         return true;
         } 
        else{
         //How to get the particular Checkbox id so that it can be unchecked? 

$(this).dialog("close");

     return false;

     } 

    });

推荐答案

                                    <tr>                                        
                                        <td><input type="checkbox" id="measure<?php echo $count;?>" name="measureid[]" value="<?php echo $items>"></td>
                                        <td><?php  echo $Name;?></td>
                                        <td>
                                            <ul id="tip" class="abuttons">
                                                <li><a class="button"><span class="edit" title="Edit"></span></a></li>
                                                <li><a rel="#yns" id="unitbtn<?php echo $count;?>" class="modalInput button"><span class="delete" title="Delete"></span></a></li>
                                            </ul>
                                        </td>
                                    </tr>

这篇关于如何将复选框 id 传递给模态框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆