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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:17:44+00:00 2026-05-14T15:17:44+00:00

Is it possible to get a value from the external CSS of a page

  • 0

Is it possible to get a value from the external CSS of a page if the element that the style refers to has not been generated yet? (the element is to be generated dynamically).

The jQuery method I’ve seen is $('element').css('property');, but this relies on element being on the page. Is there a way of finding out what the property is set to within the CSS rather than the computed style of an element?

Will I have to do something ugly like add a hidden copy of the element to my page so that I can access its style attributes?

  • 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-14T15:17:45+00:00Added an answer on May 14, 2026 at 3:17 pm

    With jQuery:

    // Scoping function just to avoid creating a global
    (function() {
        var $p = $("<p></p>").hide().appendTo("body");
        console.log($p.css("color"));
        $p.remove();
    })();
    p {color: blue}
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

    Using the DOM directly:

    // Scoping function just to avoid creating a global
    (function() {
        var p = document.createElement('p');
        document.body.appendChild(p);
        console.log(getComputedStyle(p).color);
        document.body.removeChild(p);
    })();
    p {color: blue}

    Note: In both cases, if you’re loading external style sheets, you’ll want to wait for them to load in order to see their effect on the element. Neither jQuery’s ready nor the DOM’s DOMContentLoaded event does that, you’d have to ensure it by watching for them to load.

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

Sidebar

Related Questions

Is it possible to get the value from the first page to the second
Is it possible to get the values for a TestCaseAttribute from an external data
I want to know if its possible to get the return value from batch
How is it possible to get the highest existing guid value from an existing
Is it possible to get the originating port from an ActionExecutingContext object? If so,
Possible Duplicate: Calling a webservice that uses ISO-8859-1 encoding from WCF I am trying
From a native, external library, I get a header file with enum declarations: #define
Is it possible to get the value of the dynamic filter input into a
Is it possible to get a double picker to appear from the bottom of
In my application i need to get a value from an activity to a

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.