JQuery, bind same function to 3 different textbox's keyup event?

You need do like this: edit according to request in the comment // in order to select more than one element you need to specify id's comma separated // as well may be you need to consider to use class for selected elements // then it could be just $(". ClassName") $("#element1, #element2, element3, ....") . Bind("keyup",CalculateTotalOnKeyUpEvent) You need to pass function as parameter you do not need to pass the function as it was declared.

You need do like this: // edit according to request in the comment // in order to select more than one element you need to specify id's comma separated // as well may be you need to consider to use class for selected elements // then it could be just $(". ClassName") $("#element1, #element2, element3, ....") . Bind("keyup",CalculateTotalOnKeyUpEvent); You need to pass function as parameter you do not need to pass the function as it was declared.

1 beat me to it. – geowa4 Jul 16 '09 at 14:35 probably should illuminate on how to get all three textboxes though. – geowa4 Jul 16 '09 at 14:40 You, right, I just didn't want to do it, since there was an answers after me which pointed that out.

– Artem Barger Jul 16 '09 at 14:59 I tried this $("#compensation","#adminFee", "#reimbursement"). Bind("keyup",CalculateTotalOnKeyUpEvent); and its not working – Miral Jul 16 '09 at 16:18 You doesn't do it correct. Look at mine example.It's only one string and id's separated by commas within and not several string separated by commas.

– Artem Barger Jul 16 '09 at 16:32.

$("#compensation"). Bind("keyup",CalculateTotalOnKeyUpEvent(keyupEvent)); When you write CalculateTotalOnKeyUpEvent(keyUpEvent) notice the () after function name, you are executing the CalculateTotalOnKeyUpEvent and assigning the result of the function to the key up event. You should do something like, $('#compensation, #otherId1, #otherId2') .

Bind('keyup', CalculateTotalOnKeyUpEvent); Where 'otherId1' and 'otherId2' are the ids of two more textboxes.

You are calling CalculateTotalOnKeyUpEvent immediately, not passing it as an argument. Try: $("#compensation"). Bind("keyup",CalculateTotalOnKeyUpEvent).

You got beat. Delete your answer out of respect. – geowa4 Jul 16 '09 at 14:37 How do I do that?

– joshski Jul 17 '09 at 16:21.

Or just give all 3 text boxes the same class and you good to go.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions