views:

267

answers:

2

hi,

i'm having a textbox and assigned the following function (it's the only function assigned):

txt.bind("keyup",function(event){
    if(event.keyCode==13)
    {
        var nu = $("#debug").html();
        nu+="<br>enter";
        $("#debug").html(nu);
    }
});

the strange thing is that it's actually firing twice, thus displaying "enter" twice in my debug window. anyone who knows what is causing this?

thx

A: 

i found out by myself - txt.bind was assigned twice to the textbox so it fired twice. is this a bug? i thought binding a function will always fire just once .. hmm

Fuxi
please provide your codes as asked before... we find out :-)
henchman
This is not a bug because you might want two separate functions to fire on keyup. You just have be careful when you create the binding.
EndangeredMassa
A: 

could it be possible that your html-element is contained twice within txt?

it would be helpful if you would provide the html and the assigning javascript-code.

henchman