Search code examples
moovwebtritium

In Tritium, can I select all children of a node?


I have a div that has several child divs. Some have ID's and classes, some do not.

I have used move_children_to() and was wondering if there is something similar to select the children.


Solution

  • There are a few different ways to select the immediate children.

    First you can do:

    $("./*") {
      # code for children goes here.
    }
    move_children_to("..", "after)
    

    Another way to handle this would be to just open a scope on move_children_to()

    move_children_to("..", "after) {
      # children code can go here.
    }
    

    I hope this helps! Let me know if I can provide any more assistance.