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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:11:51+00:00 2026-06-03T03:11:51+00:00

<head> <link rel=stylesheet type=text/css href=mystyle.css> <script src=myscript.js></script> </head> I’d like to have a function

  • 0
<head>
  <link rel="stylesheet" type="text/css" href="mystyle.css">
  <script src="myscript.js"></script>
</head>

I’d like to have a function that checks if a resource is included in the head

checkIfHeaderHas('myscript.js'); // would return true
checkIfHeaderHas('mystyle.css'); // would return true
checkIfHeaderHas('mybla.css'); // would return false

But I’m wondering how I can go about searching the head for a filename? (in the ‘src’ if it’s javascript, or in the ‘href’ if it’s a css)

  • 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-03T03:11:52+00:00Added an answer on June 3, 2026 at 3:11 am

    Using the .length in jquery would work for this. (Not tested!)

    Just check to see if a element exists with the href attribute set to your CSS file’s URL:

    if (!$("link[href='/path/to.css']").length){
    alert('not loaded');
    }else{
    alert('loaded!');
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a html like this: <html> <head> <link rel=stylesheet type=text/css media=all href=style.css> </head>
I have a list like this: <html> <head> <link type=text/css rel=stylesheet href=testli.css> </head> <body>
Here is what I have already: <html> <head> <link rel=stylesheet type=text/css href=reset.css /> <script
<html> <head> <link type=text/css rel=stylesheet `href=file:///C:/Users/Documents/style.css /> <script type=text/javascript src=file:///C:/Users/Documents/jquery-`1.7.1.js></script> <script type=text/javascript `src=file:///C:/Users/Documents/jquery.tablesorter.js></script> <script
<html><head> <link type=text/css rel=stylesheet href=file:///C:/Users/Documents/style.css /> <script type=text/javascript src=file:///C:/Users/Documents/jquery-1.7.1.js></script> <script type=text/javascript src=file:///C:/Users/Documents/jquery.tablesorter.js></script> <script type=text/javascript>
I have the following page: <html> <head> <title>Kahil</title> <link rel=stylesheet type=text/css href=csshorizontalmenu1.css /> </head>
How can I do this? <head runat=server> <title></title> <link rel=stylesheet href=default.css type=text/css> <asp:ContentPlaceHolder ID=head
<?php include('db_connect.php'); ?><head> <link rel=stylesheet type=text/css href=comment-style.css media=screen /> <script type=text/javascript src=../jquery.tablesorter/jquery-latest.js></script> <script type=text/javascript
I have the following file: <html> <head> <title></title> <link rel=css type=text/css href=/empty.css title=css />
When I run the following code: <head> <link rel=stylesheet type=text/css media=screen href=/jqGrid/ui-lightness/jquery-ui-1.8.16.custom.css /> <link

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.