Search code examples
moovweb

how to select following 2nd sibling in tritium?


I have a parent div with four children div. How do I select the second sibling when there is no class given?

<div class="parent">
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
</div>

Solution

  • $('//div[@class="parent"]/div[2]')
    

    This way second child can be selected directly