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
});
-
@SLaks. Was there any mistakes in my qustion ?Rauf– Rauf2011年03月21日 14:26:34 +00:00Commented Mar 21, 2011 at 14:26
-
You should format code by indenting it with four spaces.SLaks– SLaks2011年03月21日 14:33:04 +00:00Commented Mar 21, 2011 at 14:33
2 Answers 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 );
answered Mar 21, 2011 at 14:26
JAAulde
19.5k5 gold badges57 silver badges65 bronze badges
$('#chkSelect').change(function() {
$('.qtyToPick').blur();
});
answered Mar 22, 2011 at 5:06
Rauf
12.9k23 gold badges80 silver badges129 bronze badges
Comments
lang-js