I need to parse a not-so-well-formed html using cheerio.js in node.js (which is pretty close to jQuery) and run into this problem. The html looks like this:
<table><tbody><tr>
<td class="symbol">XXX
<td class="price"><span id="l">3,310.30</span>
</td><td class="change"><span id="c">+11.94</span> <span id="cp">(0.36%)</span></td><tr>
The browser seems to be capable to handle this case without any problem.
The problem is that the selector $('td.symbol')
will not stop at the first <td
, because of missing </td>
tag, but includes everything below. How to fix it?