Mission: To bind a click to the first TD of each row, and open the div on the LAST column.
USING THE CONSOLE LOG
Toggle Last Column
| Col 1 - Row 1 - Click me |
Col 2 - Row 1 |
Col 3 - Row 1 |
Col 4 - Row 1 |
Col 5 - Row 1 |
| Col 1 - Row 2 - Click me |
Col 2 - Row 2 |
Col 3 - Row 2 |
Col 4 - Row 2 |
Col 5 - Row 2 |
| Col 1 - Row 3 - Click me |
Col 2 - Row 3 |
Col 3 - Row 3 |
Col 4 - Row 3 |
Col 5 - Row 3 |
| Col 1 - Row 4 - Click me |
Col 2 - Row 4 |
Col 3 - Row 4 |
Col 4 - Row 4 |
Col 5 - Row 4 |
| Col 1 - Row 5 - Click me |
Col 2 - Row 5 |
Col 3 - Row 5 |
Col 4 - Row 5 |
Col 5 - Row 5 |
$("a.hideLast")
.log("FIND: anchor class = hideLast. FUNC: click")
.click( function() {
$("table tr")
.log("FIND: all of the table rows")
.each(function(i){
$(this)
.children("td:last")
.log("FIND: the very last TD")
.toggle();
} );
});
$("tr")
.log("FIND: all TR, FUNC: each")
.each(function(i){
$(this)
.log("FIND: first TD inside each TR, FUNC: click")
.children("td:first")
.click( function() {
$(this)
.log("FIND: parent TR")
.parents("tr")
.log("FIND: last TD")
.children("td:last")
.log("FIND: the div, FUNC: show")
.children("div").show();
} );
});