Conditionally remove blur

Conditionally remove blur

I have a textbox that is on the page to accept a barcode scanners output. In most cases this textbox must never loose focus.

So I added this..

  1.     $('#barcode').blur(function () {
            setTimeout(function () {
                $('#barcode').focus();
            }, 100);

        });





So far so good. However I have a condition were if the scanned item for some reason is not found, a div appears which contains a simple form where they can manually enter the item information.

Here is the problem.

If this div and it's form are visible, how do I kill the blur event on this textbox. Likewise, how do I put it back when the manual entry form is hidden again?