views:

56

answers:

2

I want execute below callback()method after completion of process document.getElementById('btnDownload').click(); method. click() is the code behind method. That means, I mean after complete process of click() then excute callback() method.

Because my modelpop is not hiding in code behind. So I want hide in javascript method.

function LoadPopup() { 
    //  find the popup behavior 
    this._popup = $find('mdlPopup'); 
    // show the popup 
    this._popup.show(); 

    // synchronously run the server side validation ... 
    document.getElementById('btnDownload').click(); 
   callback();          
} 


 function callback() { 
    this._popup = $find('mdlPopup'); 
    //  hide the popup 
    this._popup.hide(); 
    alert("hi"); 

}

A: 


jQuery("#btnDownload").click(function () {
    jQuery("#mdlPopup").fadeOut(800);
});

/* to call that anonymous function again, just use the trigger() method */
// jQuery("#btnDownload").trigger("click");

mike clagg
A: 

Make the code wait for the result of the first function.

if(document.getElementById('btnDownload').click())
   callback();

If the function returns true then run the second function.

Nate