Day | No. | Intervals | Time | Actual | Note |
-1 | 1 | -25 | 07 : 00 | 07:00 | |
-1 | 2 | -24.5 | 07 : 30 | 07:30 |
function(){}的外殼省略, 直接寫內容
1. 抓同欄的前一個
$(this).next().text();
2. 抓前一欄
$(this).parent().prev().children().text();
$(this).parent().prevAll(":last").children().text();
//二選一, 以此例而言, 結果相同
//而「parent().prev().children()」或「parent().prevAll().children()」,的作用, 是要先退到外層 移動, 再進到裡面抓東西
3. 抓第一欄
$(this).parent().prevAll(":last").children().text();
//別懷疑, 用prevAll()抓第一欄要用":last", 有點像感染擴散的方式
4. 抓第n欄, 第m個元素(例如Note為起點)
$(this).parent().prevAll(":eq(2)").children(":eq(0)").text();
//第一順位為0, Actual=prevAll("eq(0)"), Time=prevAll(":eq(1)")...
----
那不同列呢? 其實只要再往外退
用「.parent().parent()」或是「.parentsUntil("tr")」都可以 :D
鑽進去的方法也只是children()的延伸而已喔~
不過鑽的那層, 需要影響複數特定標籤的話, 可以用「>」 (ex:"tr>td")
這樣底下所有的<td>都會套用到喔
沒有留言:
張貼留言