0

I am using the SP file attachment modal to attach files to list items and I am having an issue with trying to target the OK button click event.

I know I can use the dialog callback once it finishes, but how can I target it this at the start once the user clicks the button to upload the file?

The reason being is I have a custom loader where I want to fade the dialog-content out, fade in my loader and then when it completes in the callback, fade the loader out.

I cannot figure out how to get access to the button click event though, which is causing an issue because depending on how big the file is, it can take a minute or more to upload. In the meantime the users are sitting there with no prompts, no nothing to let them know what is going on and I get the feeling they might not wait for it to finish and just try and reload the page thinking it froze. Any help here?

To be more clear I am using SharePoint Online and am using a custom solution in angular js/jQuery as I don't have access to SharePoint Designer, so no SP Designer tips or tricks will work for me, I need a solution in javascript...

1 Answer 1

0

I supposed your problem is because the DOM element for the button is created in dinamic way.

If you are using jQuery, you can attach one event to the complet body to target the new one elements created.

Some like this.

$('body').on('click', 'button.myclass', function() {
    // do something
});
1
  • Its actually because it's being loaded in an IFrame...posted another related question here but have not gotten a working solution as of yet... stackoverflow.com/questions/47225671/…
    – MattE
    Commented Nov 10, 2017 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.