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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:19:59+00:00 2026-05-14T00:19:59+00:00

I am building a common function library but the functions inside need to reference

  • 0

I am building a common function library but the functions inside need to reference different jquery files, which they may need to be referenced in some pages but not in others.

When I called this common function library in one web page which is only going to use one function, and I don’t reference the files need it for the other function, then it will create a script error.

My question is if it would be possible to stop this script errors like…

//This if statement is what I was thinking to stop going through
    if ($(".objectdate") != null){
//This is the function that is calling other jquery files and creates error.
        $(document).ready(function() {
            $(".objectdate").datepicker({
        //Code inside.
        });
        }); 
    }

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-05-14T00:20:00+00:00Added an answer on May 14, 2026 at 12:20 am

    If I understand correctly, you want to check if something like the datepicker exists before calling it, in that case you can check like this:

    if($().datepicker != undefined) {
     $(document).ready(function() {
       $(".objectdate").datepicker({ 
       //Options...
       });
     });
    }
    

    You can use this approach to check almost any jQuery extension’s presence, just check that the $().whatever is defined.

    If you want to check if jQuery exists at all, check like this:

    if(window.jQuery) { 
     //or window.$ for your case specifically, in case of jQuery.noConflict()
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a library of various functions that will be often reused in
I'm building modular application with 2 modules which share common vo: ShopRegionVO This vo
I have a framework I am building to make some common functions (database connection)
I'm building a webapp using Tapestry in combination with Spring Security and the jQuery-library
I'm currently building a set of common functions (Search algorithm implementations), and think I'm
I am building a Rails app, and it seems that common practice is to
I am building an application that will function as a client-server application, and also
This project is in PHP, but is fairly language agnostic. I'm building a project
Basically, I am building a horizontal navigation bar. I have following markup: <ui:style src=../common.css
I'm building a custom OpenGL control which consists of a list of items where

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.