Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7745815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:07:05+00:00 2026-06-01T10:07:05+00:00

i have a html text like this: <div id=content> <p>para1</p> <p>para2</p> <p>para3</p> <p class=break>para4</p>

  • 0

i have a html text like this:

<div id="content">
    <p>para1</p>
    <p>para2</p>
    <p>para3</p>
    <p class="break">para4</p>
    <div>img</div>
    <p>para5</p>
    <p>para6</p>
    <p>para7</p>
    <p class="break">para8</p>
    <p>para9</p>
    <p>para10</p>
    <p>para11</p>
    <p>para12</p>
    <p class="break">para13</p>
    <p>para14</p>
    <p>para15</p>
    <p>para16</p>
</div>

i want to get an array like this:

//arr[0]

<p>para1</p>
<p>para2</p>
<p>para3</p>
<p class="break">para4</p>

//arr[1]

<p class="break">para4</p>
<div>img</div>
<p>para5</p>
<p>para6</p>
<p>para7</p>
<p class="break">para8</p>

//arr[2]

<p class="break">para8</p>
<p>para9</p>
<p>para10</p>
<p>para11</p>
<p>para12</p>
<p class="break">para13</p>

//arr[3]

<p class="break">para13</p>
<p>para14</p>
<p>para15</p>
<p>para16</p>

sorry for my english , how can i get this array? or with jQuery?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:07:07+00:00Added an answer on June 1, 2026 at 10:07 am

    http://jsfiddle.net/U35Yr/7/

    Basically iterate through each child and check if there’s break class

    var htmls = [];
    var html = '';
    $('#content').children().each(function() {
        var content = $('<div />').append($(this).clone()).html();
        html += content;
        if($(this).hasClass('break')) {
            htmls.push(html);
            html = content;
        }
    
    });
    if(html.length > 0) htmls.push(html); // append the last portion
    console.log(htmls);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a section of html that looks like this: <div id=faq-content> <div class=faq-topic
I have a template like this: <script id=notesTemplate type=text/html> <li class=Note> <div class=NoteDate data-bind=style:
I have some HTML like this: <input type=radio class=MyRadio name=TheName> <label for=TheLabel>the text</label> How
I have to put microdata (schema.org) in html tag like this: <div class=list_item itemtype=http://schema.org/Hotel
Suppose I have html like this: <div id=wrap> <div id=content> <span>some content</span> <div id=s1>
I have, for example, markup like this <div id=content> <p>Here is some wonderful text,
i have script like this.... <head> <meta http-equiv=content-type content=text/html; charset=iso-8859-1 /> <meta name=author content=bbbbb
Let's assume i have HTML markup like this: <body> <div id=content> <div id=sidebar> </div>
I have html which looks somethine like this <div class=portlet portlet_30> <div class=portlet_header portlet_header_30>
Say I have a simple form like this: <html> <head> <meta http-equiv=Content-Type content=text/html; charset=utf-8

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.