title: Append div only if it does not contain text JQuery
body: <p>I am creating a social media website and am trying to make a comment textarea appear when users click on a status.</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code> $(".status").click(function (){
      //Check if status div they clicked on contains a textarea already
      if($(this).closest('div').innerHTML.indexOf("&lt;textarea name='status_body'&gt;") == -1) {
  
          //Append with textarea
          var textarea = "&lt;textarea name='status_body'&gt;&lt;/textarea&gt;";
          $(this).closest('div').append(textarea);
  
      }
    });
  </code></pre>
  
  <p>This was working before I put the if statement in. Of course without the if statement a textarea will be added everytime the user clicks. I would only like for a textarea to appear if there is not one aready. </p>
  
  <p>Another method I tried and failed with is:</p>
  
  <pre><code>if(!$(this).closest('div:contains("&lt;textarea")').length &gt; 0) 
  </code></pre>