Javascript 在jquery弹出框中编辑文本区域

Javascript 在jquery弹出框中编辑文本区域,javascript,jquery,html,popupwindow,Javascript,Jquery,Html,Popupwindow,我有一个div,其中的内容显示在有序列表中,每个列表都有一个复选框。这些是通过从数据库中提取来显示的。现在我需要在选中复选框附近显示内容。到目前为止我所做的是 1) only one check box can be selected at a time 2) get the id of the check box which is selected stored to variable ids 3) then paragraph content id = "p"+checkbox id

我有一个div,其中的内容显示在有序列表中,每个列表都有一个复选框。这些是通过从数据库中提取来显示的。现在我需要在选中复选框附近显示内容。到目前为止我所做的是

1) only one check box can be selected at a time

2) get the id of the check box which is selected stored to variable ids

3) then paragraph content id = "p"+checkbox id
代码是:

$(document).ready(function(){
    $(':checkbox').bind('change', function() {
        var thisClass = $(this).attr('class');
        if ($(this).attr('checked')) {
            $(':checkbox.' + thisClass + ":not(#" + this.id + ")").removeAttr('checked');
        }

    });
});

function edit_temp(prt){
        var checkedAtLeastOne = false;

            $('input[name="check_clinic"]').each(function() {
                    if ($(this).is(":checked")) {
                       checkedAtLeastOne = true;
                       ids = $(this).attr('id');
                        }
                    });
                    if(checkedAtLeastOne){
                         p_id ="p"+ids;
                      alert(p_id);
                       }
                    else{
                          alert('Please select any clinical Interpretation');
                    }
        }
到目前为止,这是完美的工作。但是现在我需要在弹出窗口的文本区域中显示id为p_id的标记的内容。然后编辑文本,单击弹出框的更新按钮,必须在db中更新内容


有人能帮我找到解决方案吗。

您需要创建一个php文件,从数据库接收行id,并将其打印到表单中的textarea。当用户单击submit时,表单操作将更新数据库。以下是您需要执行的步骤指南:

添加一个a标记,打开popup.php?id=1,其中1是行的id 创建popup.php文件,从数据库中获取记录 在popup.php中添加一个带有textarea和submit按钮的表单元素,并使用步骤2中获取的值填充textarea 创建一个名为update.php的新文件,或者检查页面是否在弹出式php中有post请求,并使用给定的id和textarea值更新db中的值。
希望这将帮助您完成。

如果您想要一个模态框,我建议您使用fancybox或colorbox。当你说弹出窗口时,我想你会使用window.open函数来打开一个实际的弹出窗口。但是模态盒也会这样做。