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 6800443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:58:11+00:00 2026-05-26T18:58:11+00:00

I’ve got products description as text, which I can wrap into any container, but

  • 0

I’ve got products description as text, which I can wrap into any container, but that’s all what shop’s template allows me to do:

<div class="descriptionContainer">
    Some text description, some text description.
    Some text description, some text description.
    Some text description, some text description.
    Width: 80, Depth: 39, Height: 190
</div>

How can I use jQuery to replace dimensions string into:

<div class="productsDimensions">
    <div class="row">
       <span class="name">Width</span>
       <span class="value">80</span>
    </div>
    <div class="row">
       <span class="name">Depth</span>
       <span class="value">39</span>
    </div>
    <div class="row">
       <span class="name">Height</span>
       <span class="value">190</span>
    </div>
</div>

I have to do this automatically, because e-shop application osCommerce that I’m using doesn’t come with feature that allows specifying more product info than name, price and description.

Thanks for any tips!

EDITED:

Sorry but I have to be more specific to not mislead you.

What I got from shop template is:

<div class="descriptionContainer">
    Some text description, some text description.
    Some text description, some text description.
    Some text description, some text description.
    Width: 80, Depth: 39, Height: 190
</div>

So I have to find the Width, Depth, Height values first.

  • 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-26T18:58:12+00:00Added an answer on May 26, 2026 at 6:58 pm

    assuming you have Width: 80, Depth: 39, Height: 190 in an element (ie. a div, paragraph, etc.):

    var plain = $('#textContainerId').html();
    var newContent = jQuery('<div class="productsDimensions" />');
    var rows = plain.split(',');
    for (var i = 0; i < rows.length; i++) {
        var columns = rows[i].split(':');
        var name = columns[0];
        var val = columns[1];
        jQuery('<div class="row"><span class="name">' + name + '</span><span class="value">' + val + '</span></div>').appendTo(newContent);
    }
    $('#textContainerId').replaceWith(newContent);
    

    jsFiddle: Here


    To answer your edited question, you can use something like this:

    var plain = $('.descriptionContainer').html();
    plain = plain.match(/(\w+:\s*\d+)/g);
    var newContent = jQuery('<div class="productsDimensions" />');
    $(plain).each(function(index, value) {
        var columns = value.split(':');
        var name = columns[0];
        var val = columns[1];
        jQuery('<div class="row"><span class="name">' + name + '</span><span class="value">' + val + '</span></div>').appendTo(newContent);
    });
    
    $('.descriptionContainer').html($('.descriptionContainer').html().replace(/(\w+:\s*\d+,?\s*)/g, '')).append(newContent);
    

    jsFiddle: Here

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I want to count how many characters a certain string has in PHP, but
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text

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.