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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:51:16+00:00 2026-06-19T01:51:16+00:00

Is there a $.getScript equivalent in jQuery, but for loading stylesheets?

  • 0

Is there a $.getScript equivalent in jQuery, but for loading stylesheets?

  • 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-19T01:51:18+00:00Added an answer on June 19, 2026 at 1:51 am

    CSS is not a script, so you dont have to “execute” it in the sense of script execution.

    Basically a <link> tag created on the fly and appended to the header should suffice, like

    $('<link/>', {
       rel: 'stylesheet',
       type: 'text/css',
       href: 'path_to_the.css'
    }).appendTo('head');
    

    or

    var linkElem = document.createElement('link');
    document.getElementsByTagName('head')[0].appendChild(linkElem);
    linkElem.rel = 'stylesheet';
    linkElem.type = 'text/css';
    linkElem.href = 'path_to_the.css';
    

    if you want to do it without jQuery.

    The browser will respond to the change in the DOM and update your page layout accordingly.


    EDIT:

    I have read that old Internet Explorer has trouble with this, and you might need to do it like in answer to make it work:

    https://stackoverflow.com/a/2685639/618206


    EDIT2:

    Reading the file content and putting it inline (between <style> tags) is also a valid solution, but that way the CSS will not be cached by the browser.

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

Sidebar

Related Questions

I was wondering if there is a MooTools equivalent to jQuery's .getScript() ? I'm
Is there some equivalent to jQuery's getScript in Prototype ?
What I've Tried jQuery's $.getScript does two of those things, but I don't know
I am trying to dynamically load a jQuery plugin by calling getScript - but
So I'm trying to load a javascript remotely using jquery's $.getScript, but I'm puzzled
There's a Rails 3.2.3 web application which doesn't use any database. But in spite
There are nice SO question and answers about this issue, but these options didn't
i execute a javascript with jQuery $.getScript. In the executed script i haven't access
I have created a website loading progress bar using Jquery UI Progress bar. This
When I load a script with .getScript('file.js') is there a way to do remove

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.