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. Does anyone know what is causing this?
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.
I know it's been quite awhile, but I'm surprised nobody suggested:
If somehow txt got bound already, calling unbind before your new bind should fix it. Of course it's preferable to figure out why it's being bound twice. This just happened to me, because I accidentally had my JavaScirpt file included twice. Calling unbind helped me determine that was the problem.