title: How can I get an specific element with jQuery
body: <p>I have a row of boxes with products inside. They all differ in name since all have the product's id attached with a 
  
  <pre><code>&lt;div id="plus" name="&lt;?php echo $_item-&gt;getId()?&gt;" onclick="greenUp()"&gt;+&lt;/div&gt;
  </code></pre>
  
  <p>That is the + sign to add that is going to be placed in top of each product.</p>
  
  <pre><code>var count = 0;
  function greenUp() {
      var idProduct = document.getElementById('plus').getAttribute('name');
      if (count == 0) {
          console.log(idProduct);
          jQuery('input[name='+idProduct+']').addClass('selected-plus');
          count = 1;
          console.log(count);
      }
      else {
          jQuery('input[name='+idProduct+']').removeClass('selected-plus');
          count = 0;
          console.log(count);
      }
  }
  </code></pre>
  
  <p>This is the function I am trying to apply to green up each box when clicked, however, when I click the first box It works, but if I click the second box the first one will get turned off, like if they where only one element. 
  Any ideas will be appreciated.</p>
  
  <p>EDIT:
  For future references
  All the answers below made a lot of sense for me, I don't know why it didn't work. 
  What I resolve to do was assign the value of the id directly to the function as below:</p>
  
  <p><code>&lt;label for="related-checkbox&lt;?php echo $_item-&gt;getId()?&gt;"&gt;&lt;div id="&lt;?php echo $_item-&gt;getId()?&gt;" class="plussign" onclick="greenUp(&lt;?php echo $_item-&gt;getId()?&gt;)"&gt;+&lt;/div&gt;&lt;/label&gt;</code></p>
  
  <p>and change the function as below:</p>
  
  <pre><code>        var setup = new Array();
      function greenUp(id) {
          var idProduct = id;
          if (typeof(setup[id]) == 'undefined' || setup[id] == 0) {
                  jQuery('#'+idProduct).addClass('selected-plus');
                  setup[id] = 1;
              }
          else{
                  jQuery('#'+idProduct).removeClass('selected-plus');
                  setup[id] = 0;
          }
      }
  </code></pre>