title: get innerHTML from DOM using cheerio
body: <p>This Meteor server code tries to extract the innerHTML from a html string using <code>cheerio</code> package but the error says that the <code>elements</code> has no method 'size'</p>
  
  <p>What am I doing wrong and how to fix it? Thanks</p>
  
  <p>here is the html;</p>
  
  
  
  <pre class="lang-html prettyprint-override"><code>&lt;span class='errorMsg'&gt;some text &lt;/span&gt;
  
  
  
  message: (html, typeMsg) =&gt; {
        let $ = cheerio.load(html);
        const selection = 'span.' + typeMsg;
        const elements = $(selection);
        return elements.size() &gt; 0 ? elements.get(0).innerHTML.trim() : '';
      }
  </code></pre>