PHP가 동적으로 많은 수의 테이블을 생성하고 이들 테이블 각각에 동적으로 생성 된 행 수가있는 파일이 있습니다.동적으로 생성 된 테이블에서 jQuery로 셀에 액세스하기
<?php foreach($trees as $tree): ?>
<div class="tree">
<table>
<thead>
<tr>
<th>Fruit</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<?php foreach($tree as $fruit => $fruitPrice) ?>
<tr>
<td><?php echo $fruit; ?></td>
<td><?php echo $fruitPrice; ?></td>
</tr>
<?php endforeach; ?>
<tr>
<td>Total:</td>
<td class="totalPrice"></td>
</tr>
</tbody>
<table>
</div>
<?php endforeach; ?>
결과적인 표는 다음과 같을 것이다 (그러나 그 테이블 (100)에 근접있을 것입니다) : 나는 jQuery를이 값의 총 합계를 사용하여 <td>
들에 접근 할 방법
<div class="tree">
<table>
<thead>
<tr>
<th>Fruit</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Apple</td>
<td>$1.99</td>
</tr>
<tr>
<td>Banana</td>
<td>$1.29</td>
</tr>
<tr>
<td>Peach</td>
<td>$2.25</td>
</tr>
<tr>
<td>Total:</td>
<td class="totalPrice"></td>
</tr>
</tbody>
<table>
</div>
총 가격을 .totalPrice
으로 표시 하시겠습니까?
동적 인 테이블이 나를 자극합니다.
루프 내에서 루프를 작성하려고했지만 올바른 필드에 액세스 할 수 없습니다.
쇼. –