I have this code which is in the middle of a loop:
$('input[name="field_add_more"]').trigger('mousedown');
mycustomfunction();
But the mycustomfunction(); is not always executed. I need to move this into a callback for .trigger() but I cannot figure out how to do this, and there is no documentation for it on jQuery. Can this be done?
I really don’t want to have to use a setTimeout on it. Also it HAS to be a .trigger() for it to work. Binding a 'click' does not work.
Any ideas how I can do this? I’ve tried the following but it does not work:
$('input[name="field_add_more"]').trigger('mousedown', function() {
mycustomfunction();
});
1 Answer