form api ajax stops javascript loading I have set an ajax callback to a form using the form api #ajax. I also have custom jquery in a file which styles part of the page and sets click handlers. I found something funny - my custom javascript only begins working AFTER the ajax has been called on the drupal form. Before I that form api ajax is called, it doesn't work. 

Why would this be?

EDIT:

I am attaching my behaviors like this:

(function($) {
  Drupal.behaviors.updateCart =  {
    'attach': function(context) {
    $(document).ready(function () {...

This file is being included inside of my modules hook form alter:

if($form_id == 'commerce_checkout_form_checkout') {
  drupal_add_js('sites/all/modules/my_subscription/js/updateCart.js');
}
Even with the extraneous jQuery ready function within the behavior, it should still work. I guess it depends on what code resides within the javascript function and if all the jQuery selectors actually exist at that point. I would change two things to make it more "drupal"


Per my earlier comment, remove the jQuery ready function from within the attached behavior function
Attach the form javascript using the Form APIs #attached property. See here for more info.