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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:17:51+00:00 2026-06-10T12:17:51+00:00

I have this html <tr> <td>Test</td> <td>324</td> </tr> My default CSS is text-align:left But

  • 0

I have this html

<tr>
   <td>Test</td> 
   <td>324</td>
</tr>

My default CSS is text-align:left

But I want to apply text-align:center to any <td> that contains digits.

I have about 50 HTML files so I can’t add class manually.

  • 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-10T12:17:52+00:00Added an answer on June 10, 2026 at 12:17 pm

    You could use filter and some regex magic:

    $('td').filter(function() {
      return /^\d/.test($(this).text());
    }).css('text-align', 'center');
    

    The above regex is a bit simple, if you need more precision use this one:

    /((?!\w+[^\s]))\d+\1/
    

    The above will match (space)123 and 123(space) but not 123a or asd 123 so basically only numbers and spaces allowed if that’s what you’re looking for. To add more valid characters just put them like [^\s,], that will make the comma , valid too.

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

Sidebar

Related Questions

if i have this html <div class=whole>This is a <div class=min>Test</div></div> i want to
For example if I have this html: <div>this is a test < text</div> the
i have this simple html form: <form action=test/ method=get accept-charset=utf-8> <input type=text name=first value=
i have this simple html form: <form action=test/ method=get accept-charset=utf-8> <input type=text name=first value=
hi i have this html code : <div id=#div><a href=>Test</a></div> i want attach click
I have this html code: <marquee align=left id=LatestNewsM SCROLLAMOUNT=4 loop=infinite direction=right> <font dir=rtl valign=top
I have this code: <div id=star-rating> <script type=text/javascript> $(function(){ $('#star-rating form').submit(function(){ $('.test',this).html(''); $('input',this).each(function(){ if(this.checked)
I have this text file filled with some html code; <span>test</span><p>welcome</p> <span>Guest</span><p><img class=insertedImage src=/dynamictemplate/uploads/temp/167-5-IMG_0755.JPG
If I have this HTML: <a id=test referenceId=test23 href=''>Test</a> and I want to get
I have this HTML field: <input type=text name=userInput id=userInput> I want to make sure

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.