title: How to compare two strings regardless of their capitalization?
body: <p>I have:</p>
  
  <pre><code>mytext = jQuery('#usp-title').val();
  </code></pre>
  
  <p>then I do</p>
  
  <pre><code>if(jQuery("#datafetch h2 a").text() == mytext) {
  </code></pre>
  
  <p>But one title could be:</p>
  
  <p><code>Space Mission</code> just as well as <code>space mission</code></p>
  
  <p>I cannot standardise the text format for other reasons therefore I am really looking at comparing two strings regardless of their capitalisation.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The thing is that I am using the input field as a search so the user could type <code>space mission</code> while the post title would be <code>Space mission</code> so the search result wouldn't be exact and i need the exact phrase instead.</p>
  
  <p>Complete code:</p>
  
  <pre><code>&lt;div id="datafetch"&gt;&lt;/div&gt;
  
  function fetch(){
    jQuery('#datafetch').empty();
    mytext = jQuery('#usp-title').val();
      jQuery.ajax({
          url: '&lt;?php echo admin_url('admin-ajax.php'); ?&gt;',
          type: 'post',
          data: { action: 'data_fetch', exactwords:  mytext },
          success: function(data) {
              jQuery('#datafetch').html( data );
          if(jQuery("#datafetch h2 a").text().toLowerCase().trim() == mytext.toLowerCase().trim()) {
              jQuery("#componi").attr("disabled", "disabled").hide();
          } else {
                  jQuery("#componi").removeAttr("disabled", "disabled").show();
          }
              if(jQuery("#datafetch h2 a").text() != mytext) {
              jQuery("#fatto").hide();
              jQuery('#datafetch').empty();
          }
          }
      });
  
  }
  </code></pre>
  
  <p>It's trickier actually because the search is coming from the text input, so it's about the query of the ajax i believe more than capitalisation, just a thought. The latest code above gives no results by typing:</p>
  
  <p><code>space mission</code> while the post title is <code>Space mission</code></p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Post article title:</p>
  
  <pre><code>Space Mission
  </code></pre>
  
  <p>User searches for </p>
  
  <pre><code>space mission
  </code></pre>
  
  <p>Console.log(data) gives correct result</p>
  
  <pre><code>   &lt;ul class="list-unstyled margin-top-80"&gt;
         &lt;li&gt;
              &lt;h2&gt;&lt;a target="_blank" href="example.com""&gt;Space Mission&lt;/a&gt;&lt;/h2&gt;
         &lt;/li&gt;
     &lt;/ul&gt;
  </code></pre>
  
  <p>Yet this doesn't happens:</p>
  
  <pre><code>jQuery('#datafetch').html( data );
  </code></pre>
  
  <p>if I insert the right words <code>Space Mission</code> does tho</p>