title: get html from td using jQuery
body: <p>I have a following jQuery. I am trying to fetch the html from td with having class &quot;mainlisting&quot; but i gives me &quot;undefined&quot; but if use other class i am able to get the value.</p>
  <p>Not sure what i am doing wrong.</p>
  <p>Here is my code</p>
  <pre><code>&lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js&quot;&gt;&lt;/script&gt;
  &lt;script&gt;
  
  jQuery(document).ready(function() {
  var currentHTML = '&lt;td&gt;&lt;div class=&quot;listing-report-partner partner-id-559&quot;&gt;&lt;div class=&quot;print-icon print-partner-icon-sml&quot; style=&quot;float: left&quot;&gt;&lt;img src=&quot;#&quot;&gt;&lt;/div&gt;&lt;div class=&quot;partner-name&quot; style=&quot;float: none; margin-left: 45px;&quot;&gt; Facebook&lt;br&gt; &lt;a class=&quot;viewlink&quot; href=&quot;#&quot; target=&quot;_blank&quot;&gt;view listing&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;mainlisting&quot; width=&quot;100px&quot;&gt;&lt;span class=&quot;&quot;&gt;Teste&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;mainlisting&quot; width=&quot;100px&quot;&gt;&lt;span class=&quot;notmatch&quot;&gt;Test Address&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;mainlisting&quot; width=&quot;150px&quot;&gt;&lt;span class=&quot;&quot;&gt;123-345-666&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50px&quot;&gt;&lt;div class=&quot;diagnostic-status status-alert&quot;&gt; &lt;img src=&quot;#&quot;&gt;&lt;div class=&quot;listing-status&quot;&gt;&lt;span&gt;Alert&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt;';
  
  
  name = jQuery('td.mainlisting:nth-child(1)', currentHTML).html();
  alert(name);
  Status = jQuery('.listing-status span',currentHTML).html();
  alert(Status);
  
  
  });
  
  &lt;/script&gt;
  </code></pre>