Debugging jQuery selectors

This is a good link on debugging jQuery selectors. This important code is shown at the end of the article:

$(function() {
    # ...
    $.post('/some/url', someData, function(response) {
        window.debug_elem = $('#foo-element');
        console.log(window.debug_elem);
        $('#foo-element div .bar-element').html(response);
    });
});