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 ...
this.functionA = function(parameter1, parameter2){ $.blockUI(TextEditLayer, {border:'none'}); $('#button').unbind('click').one('click', function() { // note var oAjaxObject = new Array(); oAjaxObject[0] = TextEditTextbox.value; oAjaxObject[1] = iJobNumber; myNamespace.myClass.myAjaxMethod(oAjaxObject); $.unblockUI(); }); } (If the assumptions are incorrect, then probably so is the solution) On Nov 15, 11:18 am, "window.close" <[EMAIL PROTECTED]> wrote: > Hello, > > i have a problem with a function (functionB) i bind to the click event > of a button. Every time the function (functionA) which binds this > event is called, it adds functionB another time. So after i called > functionA five times, functionB runs five times on button click. I > tried to unbind this event in functionB, but it does not seem to work. > > I hope anybody understands this squirrel dropping of a post ... > > An example code with my problem: > > this.functionA = function(parameter1, parameter2){ > $.blockUI(TextEditLayer, {border:'none'}); > > $('#button').bind('click', function() { > var oAjaxObject = new Array(); > oAjaxObject[0] = TextEditTextbox.value; > oAjaxObject[1] = iJobNumber; > myNamespace.myClass.myAjaxMethod(oAjaxObject); > $.unblockUI(); > $('#button').unbind(); > }); > }