On Nov 15, 4:11 pm, "window.close" <[EMAIL PROTECTED]> wrote: > Hello Wizzud and thank you for your reply! > > > Assuming that function A can be called an unknown/unspecified number > > of times before #button may actually be clicked, and that what happens > > when #button is eventually clicked is determined by the most recent > > call to function A, then ... > > No, after functionA is called, the page is blocked by blockUI - I can > either unblock it with the submit button or the cancel button.
>From your original code... this.functionA = function(parameter1, parameter2){ // blockUI - yes I can see that $.blockUI(TextEditLayer, {border:'none'}); // ONE button here - submit or cancel, I don't know which. // If there's a second button - as you state - somewhere else then // this one may not be clicked for any 1 particular call to functionA, // in which case the first part of my assumption holds true $('#button').bind('click', function() { var oAjaxObject = new Array(); oAjaxObject[0] = TextEditTextbox.value; oAjaxObject[1] = iJobNumber; myNamespace.myClass.myAjaxMethod(oAjaxObject); $.unblockUI(); $('#button').unbind(); }); } If the first part of my assumption is true, then the fact that your code is binding a click handler to #button each and every time that functionA is called means that the second part of the assumption must also hold true. > > If I use> $('#button').unbind('click').one('click', function() { > > the function is never called. I assume you mean the anonymous click handler never runs? If, having called functionA, you have a element on your page with a *unique* id of 'button', and you click it, then there is absolutely no reason why the following code would not run (assuming it doesn't break)... var oAjaxObject = new Array(); oAjaxObject[0] = TextEditTextbox.value; oAjaxObject[1] = iJobNumber; myNamespace.myClass.myAjaxMethod(oAjaxObject); $.unblockUI(); ie. everything inside the anonymous click handler function bound to #button (I've excluded the unbind). The only thing that could prevent it running when #button was clicked would be if some other bit of code subsequently unbound the click event from #button before it could be clicked upon? > > If I try> $('#button').unbind('click'); > > $('#button').bind('click', function() { > > no event is unbound - it's called as often as I call functionA > > Any guess? Is #button unique? What version of jQuery are you running? Is there some other code I am unaware of ? Like the second button's click handler, maybe?