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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:22:00+00:00 2026-05-20T14:22:00+00:00

I have multiple divs in my page as: <div imageId=’image5′ name=’5′ class=’speechBubble’> <div imageId=’image5′

  • 0

I have multiple divs in my page as:

<div imageId='image5' name='5' class='speechBubble'>
<div imageId='image5' name='5' class='speechBubble'>
<div imageId='image6' name='6' class='speechBubble'>
...

With jquery, I want to loop these divs for the given userId. I need to say loop divs that have class ‘speechBubble’ and name n (5,6)

Thank you

  • 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-20T14:22:00+00:00Added an answer on May 20, 2026 at 2:22 pm

    You could use the .filter() and .each() functions:

    $('.speechBubble').filter(function() {
        return this.name.match(/^[56]{1}$/);
    }).each(function(index, element) {
        // TODO: do something with the element
        // for example get the imageId attribute
        var imageId = $(element).attr('imageId');
    });
    

    If you want to match against a userId variable you don’t need the filter function. You could do this:

    $('.speechBubble[name=' + userId + ']').each(function(index, element) {
        // TODO: do something with the element
        // for example get the imageId attribute
        var imageId = $(element).attr('imageId');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have multiple divs with the same class on my page. I want to
I have multiple instances of a div with an id of myDiv on a
I have some page layouts that require multiple columns and all of their content
This is a strange problem. I have two html pop-up windows, just hidden divs
Basically what I'm trying to accomplish is I want to check multiple dynamic forms
Here's the HTML <div class=panel id=Panel1> <fieldset style=position: absolute; top:8px; left: 136px; width: 136px;
I have a widget-like block of HTML+JavaScript that people can copy/paste into their HTML-page
I have a listbox in a form, and based on the answers within I
i am new to jQuery and i am having some rollover issues, i am
I am not sure where i've seen this before, but im sure that there

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.