title: Compare tag text value with a variable in jquery
body: <p>I'm trying to compare the value of a tag obtained by query selector in the DOM with a given variable.</p>
  
  <p>So far I've only managed the use of "contains" function, but I need to compare with an equality function.
  The DOM element I need to obtain is "span:badge" and the variable to compare is "current_id".</p>
  
  <p>This is the code I need to change:</p>
  
  <pre><code>var $a = $('span.badge:contains("' + current_id + '")').closest('a');
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>$(document).ready(function() {
    "use strict";
      var current_id = window.location.pathname.replace('/califications/','');
      if (Number.isInteger(parseInt(current_id, 10))){
          var $a = $('span.badge:contains("' + current_id + '")').closest('a');
          $($a).addClass('active');
      }else{
          $('#middle_column &gt; div &gt; h1').html("No kid selected");
      }
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;ul class="nav nav-pills flex-column" id="kid_list"&gt;
   &lt;t t-foreach="kids" t-as="kid"&gt;
    &lt;li class="nav-item"&gt;
     &lt;a t-attf-href="/califications/{{kid.id}}" t-attf-class="nav-link"&gt;&lt;t t-esc="kid.name"/&gt;
      &lt;span class="badge badge-pill float-right" style="display: none;"&gt;&lt;t t-esc="kid.id" /&gt;&lt;/span&gt;
      &lt;/a&gt;
    &lt;/li&gt;
   &lt;/t&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Thanks for reading!</p>