亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

特定行的 Jquery html()

特定行的 Jquery html()

PHP
收到一只叮咚 2022-07-09 10:35:30
我已經使用類型(選擇)、名稱(文本)、單位(選擇)創建了動態行,我正在為更改類型的選擇編寫代碼。但是,當我從類型字段中更改值時,它已將值加載到當前行名稱字段中,并將選項動態加載到當前單元選擇字段中,將值加載到活動行中工作正常,但將選項加載到選擇單元中則不行。我的代碼如下$(document).on('change', '.raw', function () {    // var r = this.val();    if ($(this).val() != 0) {    var t = $(this).parents('tr').find(".raw :selected").text();    $(this).parents('tr').find(".name").val(t);我需要幫助的地方如下$(this).parents('tr').find(".amount").html(data); -> here i need help// $(".amount").html(data); ->this working fine but change all the select value提前致謝。這是我的表的完整編碼<table id="addingtable" class="table table-bordered"><tr>  <th>Raw Master</th>  <th>Name</th>  <th>Display</th>  <th>Value</th>  <th>Unit</th>  <th>Delete</th></tr><tr>  <td><select name='rawmaster[]'  class = 'form-control raw' required><option>Select</option><?php echo rawmaster_item($conn,$type);  ?><option value="0">None</option></select></td>  <td><input type='text' name='name[]'  placeholder="Name" class = 'form-control name' required /></td>  <td><select name='des[]' class = 'form-control' required><option>Select</option><option Value = 'y'>Yes</option><option Value = 'n'>No</option></select></td>  <td><input type='text' name='value[]' placeholder="Value" class = 'form-control' required /></td>   <td><select name='amount[]' class = 'form-control amount' required><option>Select</option><?php echo $output2;  ?></select></td>  <td><button type='button' class='btn btn-icon btn-danger remove'><i class='feather icon-trash-2'></i></button></td></tr>
查看完整描述

1 回答

?
ABOUTYOU

TA貢獻1812條經驗 獲得超5個贊

我可能錯了,但我認為您需要在 ajax 請求上設置上下文,否則this將引用不同的上下文(回調),添加context:this如下:


$.ajax({

    url:"plandetails_getunit.php",

    method:"POST",

    data:"id="+r,

    context:this,

    success:function(data)

    {


查看完整回答
反對 回復 2022-07-09
  • 1 回答
  • 0 關注
  • 128 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號