Jquery 选择第三个<;td>;从表中调用元素
我知道这可能很简单,但我想不出来。我需要创建级联选择框,但我不知道如何引用从调用选择框3到3的目标选择框。我试过:Jquery 选择第三个<;td>;从表中调用元素,jquery,html-table,Jquery,Html Table,我知道这可能很简单,但我想不出来。我需要创建级联选择框,但我不知道如何引用从调用选择框3到3的目标选择框。我试过: $(this).next().next().next().html(data) 但这不起作用。我怀疑这与父母的孩子有关 编辑:这是HMTL <table id="invoiceTable"> <tr> <th></th> <th class="productColumn">Product</th&g
$(this).next().next().next().html(data)
但这不起作用。我怀疑这与父母的孩子有关
编辑:这是HMTL
<table id="invoiceTable">
<tr>
<th></th>
<th class="productColumn">Product</th>
<th class="lotColumn">Lot #</th>
<th class="wheelColumn">Wheel #</th>
<th class="packageType">Pkg Type</th>
<th class="quantityField">Weight</th>
<th class="priceColumn">Price</th>
<th class="subTotalColumn">Subtotal</th>
<th class="soldOut">Sold Out</th>
</tr>
<?php
if(!$newInvoice){ $rowNum = 0;
foreach($details as $detail){ /* @var $detail Creamery_Invoice_details */?>
<tr>
<td><button type="button" class="delete">D</button></td>
<td class="productColumn">
<select name="productInputName[]" class="productSelect" id="cheeseName">
<option></option>
</select>
</td>
<td>
<select name="lotNumber[]" class="lotNumber" >
<option value=0>Lot #</option>
</select>
</td>
<td>
<select name="wheelNumber[]" class="wheelNumber">
<option value=0>Wheel</option>
</select>
</td>
<td>
<select name="packageType[]" class="packageType">
<option value=0>Pkg Type</option>
</select>
</td>
<td class="quantityField"><input name="quantity[]" type="number"> <?php echo ' value="',$detail->getQuantity(),'"'; ?>></td>
<td class=priceField><input name="price[]" type="number" step="any">
</td>
<td class="subtotalField"><input type="number" step="any" readonly="readonly"></td>
<td class="soldOut"><input type="checkbox" name="soldOut[]" <?php if($detail->getSoldOut()){echo 'checked="checked"';} ?> ></td>
</tr>
您可以使用第三个select from
productSelect
的类,即packageType
见下文
$(this).closest('tr').find('.packageType').html(data)
发布相关的HTML代码。它是关于遍历那个元素的,不看HTML是不可能回答的。你的HTML标记将是这个问题的一个非常宝贵的补充。你能给我们你的HTML代码吗?这将有助于为您提供准确的解决方案。请稍等,我需要将所有的php拉出。
$(this).closest('tr').find('.packageType').html(data)