Simple jquery instructions attached on form is not executeing I have a very simple js attached to a form, and I cannot see why it is not executing.

(function ($) {
    alert("test");
    $('#field-ai-event-date-unique-add-more-wrapper').hide();
    $('#field-ai-event-date-range-add-more-wrapper').hide();
})(jQuery);


The alert is popping up as expected, the jQuery instructions are not executed. They work fine in the console and hide the form elements as expected. 

What is the problem here?
jQuery 101: If you want to manipulate an element in the DOM, the DOM needs to be ready first.

(function ($) {
  $(function() {
    $('#field-ai-event-date-unique-add-more-wrapper').hide();
    $('#field-ai-event-date-range-add-more-wrapper').hide();
  });
})(jQuery);


See jQuery.ready().

If you can convince yourself never to forget this small fact, life will be a lot easier :)