renilative
renilative

Reputation: 159

What event should i use to check when an input box loses focus in jquery

I have a function that is executed when a textbox gains focus and another function when it loses focus. problem is i dont know where to attach the function for the lost focus event. For the focus i am using

 $(" :input[class='Txtbox']").focus(function(){
        $(this).val("");

    });

Upvotes: 0

Views: 208

Answers (4)

Shaoz
Shaoz

Reputation: 10653

Use the `blur' event handler. Then in the callback do anything you want (i'm sure you that already):

$(" :input[class='Txtbox']").blur(function(){
    // Do Something...
});

Upvotes: 1

Sang Suantak
Sang Suantak

Reputation: 5265

Use blur event.

$(" :input[class='Txtbox']").blur(function(){
    //do something
});

Upvotes: 3

pedro_sland
pedro_sland

Reputation: 5665

Use the blur() event. See http://api.jquery.com/blur/

Upvotes: 1

alexl
alexl

Reputation: 6851

$(" :input[class='Txtbox']").blur(function() {
});

Upvotes: 1

Related Questions