Ajax fired when Filefield "Add Another Item" button is clicked conflicts with my jquery I have a node type with a multivalue filefield. I am using some jquery called by my custom module to modify some of the UI in the form, but when I click the "Add Another Item" button it completely breaks and wipes out my custom external jquery. How can I fix this?
These tips are correct for Drupal 7.
Your custom code should be coordinated with Drupal AJAX Framework.
When you click "Add Another Item" this happens:  


AJAX handler sends all the form with all values, and with point to element which has triggered AJAX.
Server returns fully new field. For example, if there were 4 inputs in your field, server will return 5 inputs, not just last fifth.
After that new piece of HTML goes through all the behaviors. As you may know, behavior's attach method has two params: context and settings. context is just new HTML for your field.


So, if you add your JS to this schema correctly it must work.

Drupal.behaviors.YOURMODULE = {
  attach: function (context, settings) {
    $('.some-class', context).once('YOURMODULE', function() {
      // Do some work here
    });
  }
}