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

  • Home
  • SEARCH
  • 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 8232909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:58:30+00:00 2026-06-07T17:58:30+00:00

I have some data provided from a file.txt wich are display like this :

  • 0

I have some data provided from a file.txt wich are display like this :

<div class="nbvote">465</div>
<div class="nbvote">12</div>
<div class="nbvote">1862</div>
[...]
<div class="nbvote">3</div>

And i have in the same page multiple div (90) like this :

<div class="grid_4">
<div class="grid_4">
<div class="grid_4">
[...]
<div class="grid_4">

Now i want to add each data (465,12,1862,…,3) as class to each div class=”grid_4″ like this :

<div class="grid_4 465">
<div class="grid_4 12">
<div class="grid_4 1862">
[...]
<div class="grid_4 3">

How can i do that ? I was thinking using lenght, but i wasn’t be able to do this.

By the way, the data are the number of vote and i would like to add them as class to each div grid_4 and then sort ascending.

Sorry for my english, not my first langage.

Ty

  • 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-07T17:58:31+00:00Added an answer on June 7, 2026 at 5:58 pm

    try this:

    $('.nbvote').each(function(i, v){
       var cls = $(this).text();
       $('.grid_4:eq('+i+')').addClass(cls)
    })
    

    DEMO

    note: class names Must begin with a letter A-Z or a-z

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

Sidebar

Related Questions

I have some data from log files and would like to group entries by
I have some data and need to create a json file with this structure
I have a class that contains some data, and I would like to add
So lets say I have some code like below to pull data from another
I have some data that I would like to visualize. Each byte of the
I am using a jQuery Ajax control from this site http://abeautifulsite.net/2008/03/jquery-file-tree/ I have it
I am using PHP to expose vehicle GPS data from a CSV file. This
I need some methods of storing and getting data from a file (in WIN32
I have a project that I'm working that uses XSLT to display data from
I need some help from the shell-script gurus out there. I have a .txt

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.