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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:58:26+00:00 2026-06-09T16:58:26+00:00

I have created an online price quote. I don’t know coding that much as

  • 0

I have created an online price quote. I don’t know coding that much as I’m a small business owner and have to do most things myself. I created a jquery script and i had to keep it in the header as I dont know how to insert it in the wordpress post.

My question is: How can I make this whole Jquery script only load on http://www.leadcomm.net/cost-estimate/ ?

The script is long so i didnt post it but you can view source and it’s in the header. It’s messy, I know.

The header is used for all the pages and I think its causing some issues with other pages. Please let me know if you have any ideas, 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-09T16:58:27+00:00Added an answer on June 9, 2026 at 4:58 pm

    If you do this:

    if (window.location.href.indexOf('http://www.leadcomm.net/cost-estimate/') == 0) {
       //all jquery code here
    }
    

    it will restrict the code to any page with 'http://www.leadcomm.net/cost-estimate/' at the begining of the url. This will also account for 'http://www.leadcomm.net/cost-estimate/?qsname=qsvalue' types of urls. But it will also allow for subdirectories 'http://www.leadcomm.net/cost-estimate/dir1/dir2/'.

    If you do this:

    if (window.location.href == 'http://www.leadcomm.net/cost-estimate/') {
       //jquery code here
    }
    

    It will restrict to specifically that page.

    EDIT

    On second thought, and even better option would be to create a .js document with all of that code. Then do the below in the header to load it dynamically based on the page. This will keep the code from loading at all unless it’s needed.

    <script type="text/javascript">
    if (window.location.href == 'http://www.leadcomm.net/cost-estimate/') {
        var js = document.createElement('script');
        js.setAttribute("type","text/javascript");
        js.setAttribute("src", "jsfilename.js");
        document.getElementsByTagName("head")[0].appendChild(js);
    } 
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a dialog that creates a quote in CRM 2011 Online and
I have created an online magazine (that I hope will take off someday) using
I have created a hangman based on a jQuery code that I found online.
I have created (with help from other scripts found online) a slideshow script that
I have created an application, using ARC, that parses data from an online XML
I've created an online store within an android app in webview but have one
I have to create app that provides online radio streaming (icecast), preferably .ogg format.
I have created some JQuery that will expand a div 'popup' on hover and
I have created an android application that calls (using kSOAP library) a SOAP based
I have created a function that shows/hides different messages according to a combination of

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.