Generally there is a piece of the program

$('#mchatMsgF').keyup(function(){ 

How to add an additional variable #message ? Ie, I need the code to work for both mchatMsgF and message at the same time!

I tried this:

 $('#mchatMsgF #message').keyup(function(){ 

But it does not work, who will tell you how this is done?

  • affairs ... additional variable #message ... Verdict - >> materiel =) - Zowie

1 answer 1

This is not a variable, but an element search by id (xpath)

Try this

 $('#mchatMsgF,#message').keyup(function(){ 
  • in general, all this is here: api.jquery.com/category/selectors - aachurin
  • Damn, how can I not do it right away, you need to put a comma stupid, thanks :) - Vladislav Khromov
  • one
    @ Vladislav Khromov, for thanks there is a check mark to the left of the answer. - ling
  • @ Vladislav Khromov, who told you that you need to stupidly put a comma? Is not it easier to read stupidly at first? - Fucking Babay