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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:39:23+00:00 2026-05-26T13:39:23+00:00

I have a CMS with a form-module, which generates an awful markup, that makes

  • 0

I have a CMS with a form-module, which generates an awful markup, that makes it absolutely impossible to style. The form objects and elements is nested in an ungodly amount of tables, rows and cells.

I’m working on filtering out all the elements I need through javascript, put them in an array, and create new frontenddeveloper-friendly markup using these elements.

Inputfields, legends and fieldsets is no problem – but I have a problem filtering my labels. My labels are either wrapped like this: <tr><td>Label</td></tr> or <tr><td><b>Label</b></td></tr> – I need to filter these out, and put them in an array.

Is there a simpler way to check, if my td contains a pure string, and not an input or some other html element, other than using regex?

var regex = new RegExp(???);
jQuery("td").each( function() {
    if(jQuery(this).has("b") || regex.test(jQuery(this).text()))
    {
        // Do stuff here
    }
}

Thanks in advance

  • 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-26T13:39:24+00:00Added an answer on May 26, 2026 at 1:39 pm

    This will return all of the td’s that either have no children or have a single child which is a bold tag.

    $('td').filter(function() {
        var children = $(this).children();
        return children.length == 0 
                  || (children.length == 1 && children.first().is('b'))
    });
    

    http://jsfiddle.net/t9bMG/

    If you want to only return elements that actually have text you can use this:

    $('td').filter(function() {
        var t = $(this), children = t.children();
        return t.text().length > 0 
                   && (children.length == 0 
                        || (children.length == 1 && children.first().is('b')))
    })
    

    http://jsfiddle.net/t9bMG/1/

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

Sidebar

Related Questions

For example, I have a URL, that someone entered into a specific CMS form
I have a huge form (for an internal CMS) that is comprised by several
To install a cms i have a form in which i ask user to
I have a form that I use in my CMS that I would like
I have a form which I call via AJAX (for use on a CMS)
I have a CMS with a WYSIWYG editor which produces pretty good xhtml. Based
I have a CMS that uses a syntax based on HTML comments to let
I have a cms which stores comments against articles. These comments can be both
We have a CMS which has several thousand text/html files in it. It turns
At my current job we have a CMS system that is .NET/SQL Server based.

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.