Parse HTML using .parseHTML()


Description: Parse HTML into an HTMLCollection


<!doctype html>
    <html lang="en">
      <meta charset="utf-8">
      <title>now demo</title>
      <script src=""></script>
      <div class="container"></div>
            var htmlCollection = bitsyCode.parseHTML('<!DOCTYPE html><html><head><title>Title Tag</title></head><body><a href="#">Anchor Tag</a><p>Paragraph Tag</p><b>Bold Tag</b></body></html>', true);
            for (var i=0; i < htmlCollection.length; i++) {
                bitsyCode(".container").append(bitsyCode(htmlCollection[i]).text() + "<br />");


Title Tag
Anchor Tag
Paragraph Tag
Bold Tag
  • Usage

    • How to use:

      Parse HTML and return either an HTMLCollection or an Array of children elements

    • Simple ( Returns an HTMLCollection[] ):

      bitsyCode.parseHTML('<b>HTML Content</b>');
    • Return an Array[]: You will need to pass through a true as an option.

      bitsyCode.parseHTML('<b>HTML Content</b>', true);
  • Options

    • What options are there:

      You will need to pass through a true, if you require the return type to be an array.

  • Returns

    • Returns: HTMLCollection[] or Array[ ], of HTML children