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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:30:31+00:00 2026-05-27T07:30:31+00:00

I know this is going to be super simple for someone but i’ve just

  • 0

I know this is going to be super simple for someone but i’ve just spent 2 hours trying to figure it out.

How do I use a function inside of jquery no conflict. I keep getting Uncaught ReferenceError: swapImages is not defined (anonymous function) if I don’t use jquery no conflict the code works fine. (I have to use no conflict as it’s built into WordPress)

jQuery(document).ready(function ($) {
    function swapImages() {
        var $active = $('#myGallery .active');
        var $next = ($('#myGallery .active').next().length > 0) ? $('#myGallery .active').next() : $('#myGallery img:first');
        $active.show(function () {
            $active.show().removeClass('active');
            $next.show().addClass('active');
        });
    }
    // Run our swapImages() function every 5secs
    setInterval('swapImages()', 500);
})

See the original question here

  • 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-27T07:30:32+00:00Added an answer on May 27, 2026 at 7:30 am

    The problem is that you use setInterval improperly. Never pass a string but always pass a function – passing a string is just as bad as using eval:

    setInterval(swapImages, 500);
    

    Then you do not need any global variables/functions.

    In case you need to pass any arguments to the function, you’d wrap it in an anonymous function:

    setInterval(function() { /* your code/function call */ }, 500);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Know this might be rather basic, but I been trying to figure out how
This is going to sound super hackish but does anyone know of a way
I know this one is going to be a long-shot, but I thought I'd
I know this is a very simple question for you experts,but please forgive me.Im
I know, I know. I've Google and searched here but can't figure out what's
I know this might be a simple question but I have to make sure
I've spent a couple of days trying to find out what's going on. I
Need to know this so that i could send DTMF and that is going
Right, I know I am totally going to look an idiot with this one,
<div> <div>test</div> </div> $(div:contains('test')).css('display','none'); I know I am going to kick myself on this.

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.