JavaScript Check for Duplicate IDs on Page

Using jQuery:

function check_for_duplicate_ids() {
    // iterator over every element on page w/ id attribute set
        // find all elements on page by id where id is
        var ids = $('[id="''"]');
        if(ids.length>1 && ids[0]==this) {
        // we have more than 1 id and the id is same as
        // element we are iterating over
            console.warn('Multiple IDs #';