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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:31:33+00:00 2026-05-23T04:31:33+00:00

I have a pixel-sized table which cells’ width depends on the content. There are

  • 0

I have a pixel-sized table which cells’ width depends on the content. There are input elements in the first row of the table and I need them to have the same width as they parents (). The idea is that those inputs’ width should be calculated automatically and set in pixels with jQuery. There are no classes nor id’s for those cells and inputs. I’m able to set the width for one cell only using selectors with code like this:

var parentWidth = $(".foo").width();
$('td.foo input').width(parentWidth);

But as I said I need it to be more universal without using any classes etc.
Can anyone help me with that? Thank you!

  • 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-23T04:31:34+00:00Added an answer on May 23, 2026 at 4:31 am

    You could use a child selector like this

    $('tr:first td > input').each(function(){
        $(this).width($(this).parent().width());
    });
    

    This code should select all td of the first row and give them the width of their parent.

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

Sidebar

Related Questions

I have a table, and one of the cells has dynamically generated content. I
I have created web pages where am using pixel to position various html elements.
I have an HTML table which has equally divided rows and columns. I would
I have the following code: <table style=width: 100%; max-width: 800px; table-layout: fixed;> ... table
I have a custom table cell which contains a number of UILabels. At runtime,
I have a table column that needs to be limited to a certain width
If there an easy way to fix the width of the html table columns
I have a 300 x 300 sized UIImageView in my app which is displaying
I am new to Android. Like in iPhone we have a standard pixel sized
I have a table which can have rows and columns added to and removed

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.