Can't access elements with document.ready, from the DOM with jQuery?

Viewed 6784

I wrote a Chrome plugin, and I am listening to the 'DOM ready event' like this:

$(document).ready(function () {
    //here I select some elements and remove them.
});

Sometimes I cannot get the elements I want, even if they really exist. But when the page is loaded, I open the developer tools and run the same code in console and it works again.

I am confused why I can't get the elements when the DOM is ready, and the code I write is correct.

2 Answers
Related