I think you want the user input first then executing the rest of the code, here is what you might looking for:
for the modal window where user input, we wanna call it first the assaign a value then rest of the code execute,
$("#modal-imgupload_on").click(function () {
function lol(){
$("#modal-imgupload-content, #modal-bg-imgupload").toggleClass("active");
}
lol();
});
and now we wanna execute the rest of the code instead of pausing.
$("#img_up_sub").click(function () {
var e = document.getElementsByName('link_img_up')[0];
val = e.value;
var img_up_url = val;
if(img_up_url){
var img_edit_process = function(editor){
//do something crazy here
};
//want some function to execute after .....
}
$("#modal-imgupload-content, #modal-bg-imgupload").toggleClass("active");
//now close the modal and reset all the value
});
hope this helps :)