[問題] jQuery新手請教各位高手

看板Ajax作者 (valda)時間13年前 (2012/08/07 00:08), 編輯推噓1(102)
留言3則, 3人參與, 最新討論串1/1
請教各位,目前可以把每個tr取出 可是怎麼把每個th跟td依序取出 感謝 <!DOCTYPE html> <html> <head> <script src="./Scripts/jquery-1.7.2.js" type="text/javascript"></script> </script> </head> <body> <form> <div> <table id="tbCustmoerInfo" class="client-data"> <thead> <tr> <th> First Name </th> <th> Last Name </th> <th> Phone NO. </th> <th> Address </th> </tr> </thead> <tbody> <tr> <td> www </td> <td> huang </td> <td> 098766 </td> <td> sdqqq </td> </tr> <tr> <td> oo </td> <td> sun </td> <td> 00999 </td> <td> pl,mko </td> </tr> <tr> <td> kkk </td> <td> ko </td> <td> 34333 </td> <td> qerfqwf </td> </tr> </tbody> </table> </div> <input type="button" id="btnTest" value="Execute" /> </form> </body> <script type="text/javascript"> $(function () { console.log('init'); $('#btnTest').click(function () { btnTestEvent(); // eachTest3(); }); }); function btnTestEvent() { var v = $('#tbCustmoerInfo tr'); $(v).each(function (i) { console.log(v[i]); }); }; </script> </html> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.204.229.82

08/07 02:28, , 1F
foreach tr.find() 繼續抓
08/07 02:28, 1F

08/07 08:41, , 2F
children()
08/07 08:41, 2F

08/07 19:34, , 3F
為什麼要$(v)? 直接v.each就可以了
08/07 19:34, 3F
文章代碼(AID): #1G7-loYC (Ajax)