PHP經典實用正則表達式小結
703
2024-01-10
html代碼:
<tbody id="history_income_list"> <tr> <td align="center"><input type="text" class="input-s input-w input-hs"></td> <td align="center"><input type="text" class="input-s input-w input-hs"></td> <td align="center"><input type="text" class="input-s input-w input-hs"></td> <td align="center"><a class="" onclick="history_income_del(this);" >刪除</a></td> </tr> <tr> <td align="center"><input type="text" class="input-s input-w input-hs"></td> <td align="center"><input type="text" class="input-s input-w input-hs"></td> <td align="center"><input type="text" class="input-s input-w input-hs"></td> <td align="center"><a class="" >刪除</a></td> </tr> <tr> <td align="center"><input type="text" class="input-s input-w input-hs"></td> <td align="center"><input type="text" class="input-s input-w input-hs"></td> <td align="center"><input type="text" class="input-s input-w input-hs"></td> <td align="center"><a class="" >刪除</a></td> </tr> </tbody>
方法一:
var trList = $("#history_income_list").children("tr") for (var i=0;i<trList.length;i++) { var tdArr = trList.eq(i).find("td"); var history_income_type = tdArr.eq(0).find("input").val();//收入類別 var history_income_money = tdArr.eq(1).find("input").val();//收入金額 var history_income_remark = tdArr.eq(2).find("input").val();// 備注 alert(history_income_type); alert(history_income_money); alert(history_income_remark); }
方法二:
$("#history_income_list").find("tr").each(function(){ var tdArr = $(this).children(); var history_income_type = tdArr.eq(0).find("input").val();//收入類別 var history_income_money = tdArr.eq(1).find("input").val();//收入金額 var history_income_remark = tdArr.eq(2).find("input").val();// 備注 alert(history_income_type); alert(history_income_money); alert(history_income_remark); });
以上這篇jquery遍歷table的tr獲取td的值實現方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持綠夏網。
#免責聲明#
本站[綠夏技術導航]提供的一切軟件、教程和內容信息僅限用于學習和研究目的;不得將上述內容用于商業或者非法用途,否則,一切后果請用戶自負。本站信息來自網絡收集整理,版權爭議與本站無關。您必須在下載后的24個小時之內,從您的電腦或手機中徹底刪除上述內容。如果您喜歡該程序或內容,請支持正版,購買注冊,得到更好的正版服務。我們非常重視版權問題,如有侵權請郵件[admin@lxwl520.com]與我們聯系進行刪除處理。敬請諒解!