'How do I pass between children by jQuery?

$('[data-target="#exampleModal"]').on("click", function () {
    var element = $(this).parent();
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div class="row">
        <div class="col-md-4 col-lg-3" id="">
            <button data-toggle="modal" data-target="#exampleModal">
                <img src="./img/watch-page.png" alt="" class="w-100" />
            </button>
        </div>

        <div class="col-md-4 col-lg-3">
            <button data-toggle="modal" data-target="#exampleModal">
                <img src="./img/watch-page.png" alt="" class="w-100" />
            </button>
        </div>

        <div class="col-md-4 col-lg-3">
            <button data-toggle="modal" data-target="#exampleModal">
                <img src="./img/search-page.png" alt="" class="w-100" />
            </button>
        </div>
   </div>

How can I find out the order of the element for all of the children?

And how can I move to the next child or the one before it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source