i want to call a function when i have a textfield focused and then unfocus it (whether i press TAB or click elsewhere with the mouse) and i used this code:
$("#settings_view #my_profile_div input").focus(function() {
$(this).blur(function() {
change_my_profile();
});
});
when i first run it (have a field focused then unfocus it) it runs one time as expected. but the sencond time it calls the function change_my_profile twice. the 3rd time it ran 3 times and so on.
what is the problem here and how do i solve it (i tried with 'throw' after change_my_profile and then it only ran one time, but i want to locate the problem anyway).