Question

    var one = $("td[data-unit='sword']:first");
    var two = /*same tr, different td */  $("input[value='Selecteren']:first").click();

I want to get var two within the same tr as var one by using var one (so I can't just find td X on row X and automatically get var two on the same tr.

Was it helpful?

Solution

Use a DOM traversal function to search from the containing tr.

var two = one.closest("tr").find("input[value='Selecteren']:first").click();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top