jQuery blur keeps firing when two inputs are involved -


i've dug around while on google , here on stack overflow , can't find related this.

i've got multiple input textfields when blurred calls jquery ajax function server. works beautifully, almost.

the problem if have focus on 1 text input , click on 1 (making in focus). blur event keeps getting fired ajax calls server , alerts.

any ideas how calm blur down isn't firing? there simple i'm not doing might fix this.

here's code (ignore {{}} , {%%} tags, django template).

the inputs:

    <td class="tracking-text">ck req:</td><td class="tracking-td"><input class="tracking-input" type="text" value="{{pr.checkreq|default_if_none:"&nbsp"}}" size="10"></td>     <td class="tracking-text">lpd:</td><td class="tracking-td"><input class="tracking-input" type="text" value="{{pr.lpd|default_if_none:""}}" size="10"></td>     <td class="tracking-text">pr#</td><td class="tracking-td"><input class="tracking-input" type="text" value="{{pr.prnumber|default_if_none:""}}" size="10"></td>     <td class="tracking-text">date:</td><td class="tracking-td"><input class="tracking-input" type="text" value="{{pr.prdate|default_if_none:""}}" size="10"></td> 

the jquery:

        $('.tracking-input').blur(function(){              $.post( "{% url buy.views.update_purchase_ajax %}",                 {pr_pk: $('span#pr_pk').html()},                 function(data){                     alert(data.message);                 }, 'json');           }); 

any ideas appreciated.

the alert causing again lose focus, firing off ajax request.

maybe fix sending ajax request if input not empty?

is alert needed or debugging? prime example why shouldn't use alert debugging. use console.log.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -