title: How to get attributes of html to jquery
body: <p>I was trying to implement like and dislike button to comments by the guidance from a tutorial, but i cannot get attributes from my code.</p>
  
  <p>this is my html code including php</p>
  
  <pre><code>&lt;a id="' . $quote-&gt;quote_id . '" data-toggle="tooltip" title="'. $language-&gt;list-&gt;tooltip-&gt;like .'" class="clickable like tooltipz"&gt;&lt;span class="glyphicon glyphicon-plus red"&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;
  
  &lt;span class="up_votes"&gt;&lt;?php echo ($vote_up); ?&gt;&lt;/span&gt;
  
  &lt;a id="' . $quote-&gt;quote_id . '" data-toggle="tooltip" title="'. $language-&gt;list-&gt;tooltip-&gt;dislike .'" class="clickable dislike tooltipz"&gt;&lt;span class="glyphicon glyphicon-minus red"&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;
  
  &lt;span class="up_votes"&gt;&lt;?php echo ($vote_down); ?&gt;&lt;/span&gt;
  
  $quote-&gt;quote_id is integers like 1,2
  $language-&gt;list-&gt;tooltip-&gt;like = Like comment
  $language-&gt;list-&gt;tooltip-&gt;dislike = Dislike comment
  $vote_up = total likes
  $vote_up = total dislikes
  </code></pre>
  
  <p>this is the jquery part</p>
  
  <pre><code>//####### on button click, get user like and send it to vote_process.php using jQuery $.post().
      $(".glyphicon").on('click', '.glyphicon', function (e) {
  
          //get class name (down_button / up_button) of clicked element
          var clicked_button = $(this).children().attr('class');
  
          //get unique ID from voted parent element
          var quote_id    = $(this).parent().attr("id"); 
  
          if(clicked_button==='glyphicon-minus') //user disliked the content
          {
              //prepare post content
              post_data = {'quote_id':quote_id, 'vote':'down'};
  
              //send our data to "vote_process.php" using jQuery $.post()
              $.post('processing/process_votes.php', post_data, function(data) {
  
                  //replace vote down count text with new values
                  $('#'+quote_id+' .down_votes').text(data);
  
                  //thank user for the dislike
  
              }).fail(function(err) { 
  
              //alert user about the HTTP server error
              alert(err.statusText); 
              });
          }
          else if(clicked_button==='glyphicon-plus') //user liked the content
          {
              //prepare post content
              post_data = {'quote_id':quote_id, 'vote':'up'};
  
              //send our data to "vote_process.php" using jQuery $.post()
              $.post('processing/process_votes.php', post_data, function(data) {
  
                  //replace vote up count text with new values
                  $('#'+quote_id+' .up_votes').text(data);
  
                  //thank user for liking the content
              }).fail(function(err) { 
  
              //alert user about the HTTP server error
              alert(err.statusText); 
              });
          }
  
      });
      //end 
  
          });
  </code></pre>
  
  <p>in jquery part i am trying to know which button is clicked by user and get id of that button</p>