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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:15:40+00:00 2026-06-15T15:15:40+00:00

Hopefully I am wording this correctly… I am trying to pass an element id

  • 0

Hopefully I am wording this correctly…

I am trying to pass an element id as an option in a jquery function:

        $('.carousel').createcarousel({
        theid: $(this).attr('id'), // this is the part I am trying to get working
        delay: 150,
        fade:300,
        slide: 700,
        effect:'slide',                   
        orientation:'horizontal',
        loop: false,
        autoplay: false     });

Within the function itself, the options are defined as o, so I can do something like:

alert(o.fade);

And it will display an alert showing “300”. However, if I do:

alert(o.theid);

It says undefined. Why?

  • 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-15T15:15:41+00:00Added an answer on June 15, 2026 at 3:15 pm

    this isn’t your object in your contect. I guess your .carousel classes each have an I’d and you want to assign it to the theid argument. However, in the object you are creating the context (this argument) doesn’t match to your jQuery element, it matches to your function, where you create the caruses. So the jQUery object you are creating, wrappes an empty HTML element and has no id. Therefor it is set as undefined.

    I think this will acomplish what you are trying to do:

    $('.carousel').each(function() {
        $(this).createcarousel({
                //theid: $(this).attr('id'),                 
                theid: this.id,  //thanks jtheman
                delay: 150,
                fade:300,
                slide: 700,
                effect:'slide',                   
                orientation:'horizontal',
                loop: false,
                autoplay: false     });
    });
    

    This will iterate over all your carousel classes, set the this context correctly and apply the createcarousel function.

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

Sidebar

Related Questions

Hopefully I am wording/asking this right. I have a Winforms, .Net 3.5, app that
Hopefully the last part of this menu I've been working on. It've got the
This is a very simple, (hopefully) question. I am new to working with DateTime
Hopefully this is just a stupid mistake, but I can't see it. ; OK
Hopefully someone knows the answer to this Java-Certification question: public static void main(String[] args)
I'm brand new to Ruby/Rails/RSpec, and hopefully this is a dumb/simple question. I'm currently
Hopefully someone can help me out with this. I am upgrading a widget from
I'm trying to develop a JQuery plug-in that will access an outside XML feed
Hopefully this will be an easy one to answer. I am working on a
Hopefully I can explain this well enough. I am working on creating a PHP

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.