如何在单击按钮后编辑特定td中的值

How to edit value in a specific td after clicking button

本文关键字:td 编辑 单击 按钮      更新时间:2023-09-26

这是我的button

<button id="Modify" role="button" class="btn btn-warning" disabled>Modify</button>

这是我的Modify button脚本

$("#Modify").click(function(e) {
    e.preventDefault();
    var id = $('#cLoanOut2 tr.active').attr('id');
    bootbox.confirm("Are you sure you want to modify this order?","No","Yes",function(r){
        if(r) {
            $.ajax({  
                url : "<?php echo $server_name; ?>/emcis_coopmain/process/PHP_groceryReleasingProcess.php",
                type : "POST",
                async : false,
                data : {
                    empgrocmstID:id,
                    todo:"Modify"
                },
                success:function(result){
                    bootbox.alert('Order Modified',function(){
                    $("#Modify").attr("disabled", true);
                    });
                    loadTable();
                }
            });   
        } else {
        }
    });
});

和我的php中的td

$html .= "<td class='qty_ordered' style='text-align:right'>$qty_ordered</td>";

我如何在点击修改按钮后编辑该td上的值?

谢谢你的帮助

如果这个类是特定于<td>的,那么就像

$("td.qty_ordered").html("<Your new value here>");

此外,如果我的假设是正确的,您可以在ajax()调用中更改success()函数中的td值。

Mabuhay !