Assuming that you are calling that from within an event call where "this" is the target element, that should work. E.g.
Code: Select all
$('.my_buttons').click(function(){
$(this).parent().next().children().get(1);
}
Otherwise if you are calling it in the body of the script then "this" references the window and the call will fail.
To get 2nd child of the 3rd sibling of the parent you can use:
Code: Select all
$(this).parent().next().next().next().children().get(1);
There are other options such as getting the parent's siblings then getting the index() of the parent plus the offset, though unless you need the 4th sibling or more then simply using .next().next().next() would be easier and faster. e.g.
Code: Select all
$(this).parent().siblings().get($(this).parent().index()+2).children().get(1)
And note how I use 2 to get the 3rd sibling as siblings() returns all siblings save for the target itself, thus the element in the index position of the siblings() would the first sibling after the target.
I use Google Chrome as my default browser, and what I find most useful is its developer tools which you can bring up by pressing (Control + Shift + i) or going to Settings -> Tools -> Developer Tools. On the page that I want to play with my jQuery commands in real-time, I go to the console tab of the developer tools, and type in the jQuery command I want to test. In your situation I would test it out first on a known target like so:
Code: Select all
jQuery('#my_button_1').parent().next().children().get(1);
If it works then the console should now display the jQuery object for the desired element. Hope this helps!