[jQuery] Problem unbinding event from button (function binds event each time it is run)
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();
});
}