すべての行にフォームが含まれているテーブルがあります。下記参照
<table>
<tr><th>Fee Type</th><th>Amount</th><th>% Discount</th><th>Discounted Amount</th><th>Payable to</th><th>Remove</th></tr>
<tr>
<form>
<td></td>
<td class="cost"></td>
<td> <input /> </td>
<td class="discount"></td>
<td></td>
</form>
<tr>
</table>
今の私の意図は、各フォームをループしてajax投稿を実行するグローバル保存ボタンを用意することです。下記参照
function saveEditedFees(){
$("#savefeechanges").click(function(){
$("#feestable form").each(function(){
alert( $(this).attr('id') );
});
});
}
私の問題は、クラス「cost」と「discount」 の要素に$(this)を使用して「td」の値にアクセスすることです。
alert( $(this).find("td").eq(2).html() );
alert($(this).siblings('.cost').text());
alert($("td .cost" ,this).text());
基本的に、に含まれる値がに<td class="cost">
等しいかどうかをテストしようとしています<td class="discount">
。このようにして、ajax投稿を選択的に実行します。
助けてください。