title: Click event in node.js does not work
body: <p>I am using Node.js + Express + Jade + Socket.io to set up click events in one browser to trigger a click on a button in another. I am having difficulty getting this to work. The code I have so far is:</p>
  
  <p>Client side (index.jade):</p>
  
  <pre class="lang-js prettyprint-override"><code>var socket = io.connect('http://localhost:8080');
    $('#buttonLeft').tap(function() {
      socket.emit('keyLeft');
    });
  });
  </code></pre>
  
  <p>Server side:</p>
  
  <pre class="lang-js prettyprint-override"><code>var sockets = {};
  io.sockets.on('connection', function (socket) {
    socket.on('keyLeft', function(){
      socket.broadcast.emit('keyLeft');
    });
  });
  </code></pre>
  
  <p>Another client side (index.php):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;
  
  &lt;head&gt;
   &lt;meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /&gt;
   &lt;link rel="stylesheet" href="slider-style.css" /&gt;
   &lt;script src="//code.jquery.com/jquery-1.11.0.min.js"&gt;&lt;/script&gt;
   &lt;script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;?php
   $imagesTotal = 8;     // SET TOTAL IMAGES IN GALLERY
  ?&gt;
  
  &lt;div class="galleryContainer"&gt;
  
    &lt;div class="galleryPreviewContainer"&gt;
      &lt;div class="galleryPreviewImage"&gt;
        &lt;?php
          for ($i = 1; $i &lt;= $imagesTotal; $i++) {
            echo '&lt;img class="previewImage' . $i . '" src="images/image' . $i . '.jpg" width="900" height="auto" alt="" /&gt;';
          }
        ?&gt;
    &lt;/div&gt;
  
    &lt;div class="galleryPreviewArrows"&gt;
      &lt;a id="previousSlideArrow" href="#" class="previousSlideArrow"&gt;&amp;lt;&lt;/a&gt;
        &lt;a id="nextSlideArrow" href="#" class="nextSlideArrow"&gt;&amp;gt;&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  // init variables
  var imagesTotal = &lt;?php echo $imagesTotal; ?&gt;;
  var currentImage = 1;
  var thumbsTotalWidth = 0;
  
  $('a.galleryBullet' + currentImage).addClass("active");
  $('a.thumbnailsimage' + currentImage).addClass("active");
  $('div.description' + currentImage).addClass("visible");
  
  // PREVIOUS ARROW CODE
  $('a.previousSlideArrow').click(function() {
   $('img.previewImage' + currentImage).hide();
   $('a.galleryBullet' + currentImage).removeClass("active");
   $('a.thumbnailsimage' + currentImage).removeClass("active");
   $('div.description' + currentImage).removeClass("visible");
  
   currentImage--;
  
   if (currentImage == 0) {
    currentImage = imagesTotal;
   }
  
   $('a.galleryBullet' + currentImage).addClass("active");
   $('a.thumbnailsimage' + currentImage).addClass("active");
   $('img.previewImage' + currentImage).show();
   $('div.description' + currentImage).addClass("visible");
  
   return false;
  });
  // ===================
  
  
  // NEXT ARROW CODE
  $('a.nextSlideArrow').click(function() {
   $('img.previewImage' + currentImage).hide();
   $('a.galleryBullet' + currentImage).removeClass("active");
   $('a.thumbnailsimage' + currentImage).removeClass("active");
   $('div.description' + currentImage).removeClass("visible");
  
   currentImage++;
  
   if (currentImage == imagesTotal + 1) {
    currentImage = 1;
   }
  
   $('a.galleryBullet' + currentImage).addClass("active");
   $('a.thumbnailsimage' + currentImage).addClass("active");
   $('img.previewImage' + currentImage).show();
   $('div.description' + currentImage).addClass("visible");
  
   return false;
  });
  // ===================
  &lt;/script&gt;
  
  &lt;script src="http://mojoer.kr:8080/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script src="slide-script.js&gt;&lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Any help would be really appreciated. Thanks~</p>