Add javascript to returned form after ajax validation
you can attach custom jQuery functions in your modules every time you load content just attaching functions to the Drupal.behaviors like this:

(function($) {

  Drupal.behaviors.your_module = {

    attach: function(context, settings){
      $('#element').bind('click', function(event){
            alert('hello!');
      });
    }

  }

}


In this way, every time Drupal loads content, no matter via ajax or a page refresh, it will automatically attach the desired behaviors. Don't forget to include the js in your pages.