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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:36:22+00:00 2026-05-21T03:36:22+00:00

I have several id that has the following name test1, test2, test3, test4 and

  • 0

I have several id that has the following name test1, test2, test3, test4 and I have the following jQuery:

jQuery(document).ready(function() {
            jQuery('#test').jcarousel({
                //something
            });
        });

I have the following code as well:

jQuery.get(
                'allmovieloader.php',
                {
                    first: carousel.first,
                    last: carousel.last
                                    id: myelementid
                },
                function(xml) {
                    mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml);
                },
                'xml'
            );

So when I call get I want to pass in the id as well, as test1, test2, test3
How should I change this jQuery code so that it works for test1, test2, test3

  • 1 1 Answer
  • 1 View
  • 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-21T03:36:22+00:00Added an answer on May 21, 2026 at 3:36 am

    It’d be far easier to assign a class-name to the various elements, and then use the class as the selector ($('.className').jcarousel({ // something })), but if you want to use ids as the selector you’ve got a couple of choices:

    First:

    $('#test1, #test2, #test3').jcarousel({ // something });
    

    Secondly:

    $('div[id^="test"]').jcarousel({ // something });
    

    Based on your comment to @Bjorn:

    I need to use id as each id name will be passed in as a parameter

    You could still use the class-name as the selector:

    $('.className').jcarousel(
        function(){
            var idOfElement = this.id;
            // other stuff
        });
    

    a side question, how can jQuery get the element name so I can pass it to get?

    To get the element name (I’m assuming you mean tag-name?) you can use:

    $('.className').jcarousel(
        function(){
            var nameOfTag = this.tagName;
            alert(nameOfTag);
         });
    

    References:

    • attribute-starts-with (^=) selector.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that currently has several methods that take integer parameters. These
I have a UIView that has several UIImageViews as subviews. Each of these subviews
I have a project that has several build configurations (FREE version, male-only, female-only, etc.).
I have a server that has several virtual machines running on it. I'm trying
I have a complex page that has several user controls like galleries, maps, ads
I have a page that has several ajax submission forms. Each form has a
I have a Bourne Shell script that has several functions in it, and allows
I have custom event that has several different subscribers who will all use the
I have an Eclipse plugin project that has several file resources that I would
I have a csv that has several columns. I need the middle columns to

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.