I am trying to mock up the Workflow form (the URL is ~siteCollection/_layouts/15/CstWrkflIP.aspx?List={xxx}) with JQuery. I have included the script file within Master Page so that whenever the URL matching, the script will hide some fields and pre-fill some input, etc.
The script fired as expected at first load. But when I click on the "Add stage" button of Approval Workflow, all the mock up is gone. I guess it is because it triggered a postback and my script is not run again.
The "Add stage" button is the highlighted one:
I have placed this line in my script:
_spBodyOnLoadFunctionNames.push("workflowMockUp");
workflowmockup is my JQ function name.
Maybe I do it wrong. It only triggered first time page is load. When I click "Add a new stage" workflowMockUp is not triggered. How can I workaround it? I cannot modify CstWrkflIP.aspx directly.