How to remove <br> and everything after that?

Viewed 982

If I do the following is fine:

<div id="results">
  <p>Hello<br>there</p>
</div>

$($("#results p").children('br').get(0).nextSibling).remove();

I get: hello

But if I do:

<th class="infobox">Head</th>
<td>Hello<br>there</td>

var newLineRemove = $(".infobox td").children('br').get(0).nextSibling();
$wikiDOM.find(newLineRemove).remove();

Gives me

Uncaught TypeError: Cannot read property 'nextSibling' of undefined

3 Answers
Related