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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:49:56+00:00 2026-05-25T09:49:56+00:00

I want a predefined class name which able to inherit css properties of immediate

  • 0

I want a predefined class name which able to inherit css properties of immediate parent class/Id. let say

<div class="super">
   <input type="button" id="any_1" />
   <div class="sub">
      <input type="button" id="any_2" />
   </div>
</div>

Now i want to enclosed the <input type="button" ... /> with a common class & this class should inherits the css properties of immediate parent node.

e.g. suppose generic is common class and i am re-writing the above example

<div class="super">
   <div class="generic"> /*This should inherits the css properties of super class*/
      <input type="button" id="any_1" />
   </div>
   <div class="sub">
      <div class="generic"> /*This should inherits the css properties of sub class*/
          <input type="button" id="any_2" />
      </div>
   </div>
</div>

is there any way to do that if the generic is selector.

  • 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-25T09:49:56+00:00Added an answer on May 25, 2026 at 9:49 am

    I posted two ways to return the class values of the input elements. EDIT: made a mistake, answer revised.

        //jquery
         $(function() {
            $('.generic').each(function() {
                  var parentClass = $(this).parent().attr('class');
                  $(this).addClass(parentClass);
            });
         });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say you want to add a lengthOfFirstLine method to the predefined File class. Is
I want to call a redefined private method from an abstract parent class. I
I want to include/embed an Excel worksheet with a predefined layout in an Excel
I just want my apache to register some of my predefined environment so that
I want to ship a default SQLite database, with some predefined key/value pairs in
I want to remove if-statements from my View, but I'm having problems with predefined
want to have a Hyperlink-Button in a gridView in which I can display a
I'm writing a program in which I want to terminate program by pressing any
I have the 2 following entities: @Entity @Table(name = brand) public class Brand {
I am trying to build an silverlight application which takes user first name, last

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.