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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:06:22+00:00 2026-05-23T15:06:22+00:00

I use several jquery plugins on my website, most of which are actually used

  • 0

I use several jquery plugins on my website, most of which are actually used only on some pages. For instance a image slider plugin that is only displayed on the starterpage.

Then I have a common file “custom.js” in which I call the functions from and it is included on every page similar to a external css style sheet. I prefer to keep it in one file and the size is not substantial.

But since I do not want to include every js-plugin file, which are sometimes quite big, on pages were the actual plugin arent displayed my problem appears. The common js file will try to call the plugins which are not included which generate a js error message: e.g. $("#slider").coinslider is not a function. How can I fix this?

  • 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-23T15:06:23+00:00Added an answer on May 23, 2026 at 3:06 pm

    There are a couple of ways to do this. The easiest would be to check for the presence of the ‘slider’ div (assuming this div was only used in one place on your site, when you have the plugin loaded):

    if($("#slider").length){
        $("#slider").coinslider()
    }
    

    You could instead catch the error that is being thrown:

    try {
        $("#slider").coinslider();
    } catch(err){}
    

    But I would recommend the first method.

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

Sidebar

Related Questions

I use several forms on my site to send data to MySQL. Which is
On the website I'm administrating, I use several include and require . I would
I'm trying to use JQuery to loop through several div's with more than one
I have a web page with several jQuery ajax calls which fire asynchronously at
I have several textareas on my page and I use jquery focus function to
I want to use the jquery autocomplete plugin across several input boxes. In order
Im using this plugin: http://www.fyneworks.com/jquery/star-rating It includes a star.gif (which actually contains the star
I use several custom tools during the build process, mostly code generators for service
I have to use several SOAP messages to get data from a web service.
In my ViewModels I use several DataAnnotations to validate the form data, there are

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.