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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:51:19+00:00 2026-05-31T23:51:19+00:00

im stuck with a problem im basically trying to create a function where I

  • 0

im stuck with a problem

im basically trying to create a function where I allocate different text (from an array) to different divs which are of the same class, these divs are differentiated by an id, here is an example of what i mean

HTML markup

<div class='actContainer'>
    <div class='msgContainer'>
       <input class='activityId' type='hidden' value='1'>
       <div class='date'> </div> 
    </div>

    <div class='msgContainer'>
       <input class='activityId' type='hidden' value='2'>
       <div class='date'> </div> 
    </div>

    <div class='msgContainer'>
       <input class='activityId' type='hidden' value='3'>
       <div class='date'> </div> 
    </div>
</div>

JQuery code

var textArr = ['time1', 'time2', 'time3'];
var id = [1, 2, 3];

$.each(textArr, function(key, value){      
   $('.actContainer').find('input#activityId').val()==id[key]
     .parent().find('div.date')
     .append("Posted message at"+textArr[key]); 
}

As you can see from the code im trying to place text between the div.date tag.

This currently doesn’t work so I must be doing something wrong, if anyone could help that would be much appreciated

  • 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-31T23:51:20+00:00Added an answer on May 31, 2026 at 11:51 pm

    You need this:

     $('.actContainer').find('input.activityId[value="'+id[key]+'"]')
         .siblings('.date')
         .text("Posted message at"+textArr[key]); 
    

    This means that you are searching for an input with the activityId class, which also has a value that is equals to id[key].
    you would like to find a div near it that has a class date, and you’d like to change it’s text content to “posted message … “

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

Sidebar

Related Questions

Im stuck with this little project in C# but basically my problem is this:
I'm trying to create a Regex javascript split, but I'm totally stuck. Here's my
Having a minor problem, I'm trying to create an about us dialog box by
I'm having an interesting but difficult problem with my JavaScript code. Basically, I'm trying
So my problem is basically this, I'm parsing through a mutable array of numbers
What I have is basically a problem which is easily solved with multiple tables,
I'm trying to make a pretty simple game and I'm stuck. Basically I want
I've got a few tables that all have the same column domainID which basically
Ok so what I'm trying to do is create an array of pointers that
I stuck with problem of mail application , i am developing a website for

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.