-1

I bound the blur function to a text box having class name 'qtyToPick'. Now I want to call the same blur function if I change checked property of a check box having class 'chkSelect'.

How can i do it ?

$('.qtyToPick').live('blur', function() {
    //  Code here
});
2
  • @SLaks. Was there any mistakes in my qustion ? Commented Mar 21, 2011 at 14:26
  • You should format code by indenting it with four spaces. Commented Mar 21, 2011 at 14:33

2 Answers 2

2

Define the function separately, and bind it to the appropriate events for the appropriate elements:

var theFunc = function() { /* Code here */ };

$( '.qtyToPick' ).live( 'blur', theFunc );
$( '.chkSelect' ).live( 'change', theFunc );
Sign up to request clarification or add additional context in comments.

2 Comments

$('#chkSelect').change(function() { $('.qtyToPick').blur(); });
I think trigger handler might be more appropriate in this case if you're taking that route.
0
$('#chkSelect').change(function() {

   $('.qtyToPick').blur();

});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.