Why do Drupal.behaviours and document.ready behave differently? I have the same piece of jQuery that works differently depending whether it is wrapped in document.ready or Drupal.behaviours. The code is intended to enumerate a list of tabs generated by the vertical tabs module.

Using

Drupal.behaviors.myModule = function (context) {  
   $('ul.vertical-tabs-list li').each(function(i){
     console.log(i);
   })
}


Logs no output, but the following works as expected. 

if (Drupal.jsEnabled) {
$(document).ready(function() {
      $('ul.vertical-tabs-list li').each(function(k){
      console.log(k);
      })
    }) 
 }


Why is there a difference and how can I get the first version to work?
Drupal.behaviours are similar to document.ready but Drupal make sures that on every ajax call code written in a Drupal.behaviour is executed again. While code written in document.ready is called once on page load.