I post a form with $.post
on the keyup
of a input type='text'
,
the problem is that after the post, I click anywhere in the browser (even on the firebug console) an the $.post
is going to be repeated
live link: http://mrgsp.md:8080/awesome/lookupdemo
(click on a button to open a popup, after search for a letter e.g. 'm' after click on something [watch the firebug console] )
my script is something like this:
$('#theform input:text').keyup(function (e) {
var w = e.which;
if (w < 9 || w > 45 && w < 91 || w > 93 && w < 112 || w > 185)
$('#theform').submit();
});
$('#theform input:hidden').change(function () {
$('#theform').submit();
});
$('#theform').submit(function(e){
e.preventDefault();
...
$.post(...);
});
UPDATE: just noticed that without the $('#theform input:hidden').change(...
all is ok
UPDATE 2: apparently the textbox also triggers change, strange cuz i registered the change for input:hidden
not for input:text
UPDATE 3: solved, it looks like I should have used input[type='hidden']
instead of input:hidden