title: Multiple variables in jquery selector
body: <p>I have a code like this</p>
  
  <pre><code>$(".class1 .class2").on('click', function(){
   //Do something        
  });
  </code></pre>
  
  <p>I am trying to somehting like this using variables:</p>
  
  <pre><code>var1=".class1";
  var2=".class2"
  
  $(var1 var2).on('click', function(){
     //Do something        
  });
  </code></pre>
  
  <p>I see <code>var1</code> and <code>var2</code> are set to right values, but everytime I try to use 2 variables as selector it fails. When I keep the click trigger unchanged and use <code>var1</code> or <code>var2</code> elsewhere in the code individually (just <code>var1</code> or <code>var2</code> but not in the same selector list) it works. Any tips?</p>
  
  <p>I figure I use <code>var3</code> concatenate <code>var1</code> and <code>var2</code>, but I am trying to reduce another variable.</p>