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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:42:09+00:00 2026-05-20T22:42:09+00:00

Just wondering, could jQuery search for all inputs that have a CSS class of

  • 0

Just wondering, could jQuery search for all inputs that have a CSS class of ‘.map’ and return the ID and class of the input into an array?

Example:

if I have the following input on my page:

<asp:TextBox ID="test" runat="server" MaxLength="12" Width="3em" CssClass="mapTest" />
<asp:TextBox ID="test1" runat="server" MaxLength="12" Width="3em" CssClass="mapTest1" />
<asp:TextBox ID="test2" runat="server" MaxLength="12" Width="3em" CssClass="mapTest2" />
<asp:TextBox ID="test3" runat="server" MaxLength="12" Width="3em" CssClass="mapTest3" />

Is it possible for jQuery to format the result in an array as below?

testArr[0] = 'test-mapTest';
testArr[1] = 'test1-mapTest1';
testArr[2] = 'test2-mapTest2';
testArr[3] = 'test3-mapTest3';

Also, in .net I have to use the following code <%= test.ClientID %> then it will only able to get me the correct ID number, so I’m not sure how can I in jquery then will only able to get the correct ID.

  • 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-20T22:42:10+00:00Added an answer on May 20, 2026 at 10:42 pm

    Sure it is!

    var my_array = [];
    $(":input[class^=map]").each(function(index, element) {
      my_array.push(element.attr("id") + "-" + element.attr("class"));
    });
    

    The above example uses jQuery’s .attr() method for accessing the element’s id and class attributes, solely for illustration purposes. It’s often faster and easier to read to access an element’s built-in attributes directly:

    var my_array = [];
    $(":input[class^=map]").each(function(index, element) {
        my_array.push(this.id + "-" + this.className);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m just wondering if anyone’s come across or could recommend an IDE that’s capable
I'm working on a custom dropdown that I made, just wondering if I could
I know that JQuery is a very powerful library and was just wondering if
I am just wondering if someone could explain what the following jQuery script does:
just wondering if anyone could suggest why I might be getting an error? I'm
Just wondering if you could help wanting to produce an activity stream in Java,
I just wondering how I could replace the second instance of a string inside
I was just wondering how I could automatically increment the build (and version?) of
I'm just wondering how I could display my last 200 mysql entries in php
I'm just wondering how I could remove everything after a certain substring in 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.