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

  • Home
  • SEARCH
  • 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 6319261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:46:33+00:00 2026-05-24T15:46:33+00:00

I’m looking for a way to target a specific marker in a document, like

  • 0

I’m looking for a way to target a specific marker in a document, like for instance !divide! or --divide-- Something that doesnt normally exist in language written by normal humanbeings yet something that doesnt take a rocket scientist to conjure and yet again one that is distinct from regular text.

Then target that !divide! and wrap text while removing !divided!. Like this:

Lorem ipsum dolor !divide! sit amet becomes >>

<p>Lorem ipsum dolor</p> <p>sit amet</p>

And

Lorem !divide! ipsum dolor !divide! sit amet becomes >>

<p>Lorem</p> <p>ipsum dolor</p> <p>sit amet</p>

This is.. Well, this is what i have so far. More than anything, it’s me trying to get my thoughts together and try to tell what im looking for here: http://jsfiddle.net/PvMJL/2/

  • 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-05-24T15:46:34+00:00Added an answer on May 24, 2026 at 3:46 pm

    This will avoid issues if you have nested .TextCont elements. If that won’t happen, you can get rid of the not()[docs] method.

    var with_dividers = $('.TextCont:contains("--divider--")')
                   .not('> .TextCont:contains("--divider--")');
    
    
    with_dividers.html(function(i,htm) {
        return '<p>' + htm.split('--divider--').join('</p><p>') + '</p>';
    });
    

    Example: http://jsfiddle.net/CFLV4/

    And I changed your IDs to classes since duplicate IDs are invalid.


    Edit: To explain, in JavaScript, you don’t append opening and closing tags. You need to think in terms of dealing with whole elements.

    In the code above, the html()[docs] method is passed a function. The return value of the function is the new content of the element. The htm parameter is passed a String of the current content.

    So what we do is take the existing content, and do a .split('--divider--'), resulting in an Array, like:

    ['<span>Lorem</span>',
      '<a href="#">ipsum</a>',
      'dolor sit amet.'
    ]
    

    As you can see, the --divider-- text has been removed, and the string split where the --divider-- was.

    Then we do a .join() on the Array, using '</p><p>' as the join text, giving us:

    '<span>Lorem</span></p><p><a href="#">ipsum</a></p><p>dolor sit amet.'
    

    …but of course we’re missing our opening and closing tags, so we add those to the beginning and end, so our code:

    '<p>' + htm.split('--divider--').join('</p><p>') + '</p>'
    

    …ultimately gives us:

    '<p><span>Lorem</span></p><p><a href="#">ipsum</a></p><p>dolor sit amet.</p>'
    

    That is the return value of the function, and therefore becomes the new content.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm looking for suggestions for debugging... If you view this site in Firefox or
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have some data like this: 1 2 3 4 5 9 2 6
I'm making a simple page using Google Maps API 3. My first. One marker
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,

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.