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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:48:10+00:00 2026-06-17T12:48:10+00:00

Here is a html page: <html> <head> <script src=http://code.jquery.com/jquery-1.9.0.min.js type=text/javascript></script> </head> <body> <script src=background.js

  • 0

Here is a html page:

    <html>
<head>
    <script src="http://code.jquery.com/jquery-1.9.0.min.js" type="text/javascript"></script>
</head>
<body>
    <script src="background.js" type="text/javascript"></script>
</body>
</html>

Here is background.js:

alert("Alert1!");
var test = jQuery.trim(" Words and / { objects & things");
alert("Alert2!");

Alert1 works, but alert2 never plays. If i remove the jQuery then it works. I’ve tried the background.js file in both the header and body. What am I doing wrong?

Thanks.

  • 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-17T12:48:11+00:00Added an answer on June 17, 2026 at 12:48 pm

    Download jquery.js from http://code.jquery.com/jquery-1.9.0.min.js and put it inline to your extension directory and refer it inline as shown here.

    Root Cause

    External reference to files is not supported in Chrome Extensions.

    Working Version

    <html>
    <head>
        <script src="jquery-1.9.0.min.js" type="text/javascript"></script>
        <script src="background.js" type="text/javascript"></script>
    </head>
    <body>
    </body>
    </html>
    

    Edit 1

    Working Version

    manifest.json

    Registered both Jquery and Your code to manifest file.

    {
        "name": "Jquery In Background",
        "description": "http://stackoverflow.com/questions/14438044/jquery-cant-be-accessed-by-other-js-file",
        "background": {
            "scripts": [
                "jquery.js",
                "background.js"
            ]
        },
        "version": "1",
        "manifest_version": 2
    }
    

    background.js

    Your code as before

    alert("Alert1!");
    var test = jQuery.trim(" Words and / { objects & things");
    alert("Alert2!" + test);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my main page code: <form><iframe name=iframe_pic src=iframe.html></iframe></form> Here is my iframe.html: <script
I am using JQuery Accordion. I have this page here: http://www.hauppauge.com/site/support/support_colossus.html#tabs-6 What happens is
Here's the whole page: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd> <html> <head>
here is my page http://www.dev.1over0.com/canvas/canvas_web.html I’m having issues with the undo functionality – I
here is the test page http://www.studioteknik.com/html/test-portfolio.html I got no error, but no hover-slide effect...
I have a page that i have been starting to setup here http://www.brandybrowauto.com/NEW.html that
Here is my html page code <html> <head> <title>Big Query & D3.js Mashup</title> <meta
here's my page <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd> <!DOCTYPE HTML PUBLIC
I'm not entirely sure what's breaking here on this page: http://grandoaks.org/floor.html but it seems
Here are the tabs in the master page: <nav> <ul id=menu> <li><%: Html.ActionLink(Home, Index,

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.