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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:20:35+00:00 2026-06-15T19:20:35+00:00

i got the following jQuery stuff where i entered the array numbers and selector

  • 0

i got the following jQuery stuff where i entered the array numbers and selector positions by feet – can i do this in one block with an for loop?

jQuery(document).ready(function(){

    jQuery('.hoverB0x:eq(0)').html('<a style="background:white;" class="imageLink" href="${createLink(uri: "/beirat/")}">Profil von' + names[0]+'</a>');
    jQuery('div.name:eq(0)').html(title[0]+' '+names[0]);
    jQuery('div.description:eq(0)').html(funktion[0]);
    jQuery('a.imageLink:eq(0)').prop('href', 'beirat/'+ident[0]);
    jQuery('a.contentLink:eq(0)').prop('href', 'beirat/'+ident[0]);
    jQuery('.profilBildInner:eq(0) img').attr('src', base+ident[0]+'.png');

Now about 10 blocks going to follow up with eq([arrayPos]) and names/ident[arrayPos]

  • 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-15T19:20:37+00:00Added an answer on June 15, 2026 at 7:20 pm

    I dont see why not… just change the indexes to use the increment counter of a for loop. You dont show how you get the names, ident, or funktion arrays but presumable they are the same size and hold the proper count of things you expect in the document so use one of those to get your base increment range.

    for (var i = 0; i < ident.length; i++){
        $('.hoverB0x:eq(' + i + ')').html('<a style="background:white;" class="imageLink" href="${createLink(uri: "/beirat/")}">Profil von' + names[i]+'</a>');
        $('div.name:eq(' + i + ')').html(title[i]+' '+names[i]);
        $('div.description:eq(' + i + ')').html(funktion[i]);
        $('a.imageLink:eq(' + i + ')').prop('href', 'beirat/'+ident[i]);
        $('a.contentLink:eq(' + i + ')').prop('href', 'beirat/'+ident[i]);
        $('.profilBildInner:eq(' + i + ') img').attr('src', base+ident[i]+'.png');
    
    }
    

    Further more if possible it would make much more sense to combine those arrays into a a single array of hahses like:

    var values = [
      {ident: 'ident_value', funktion: 'function_value', name: 'name_value'}
    ];
    

    Then you can do:

    for (var i = 0; i < values.length; i++){
        $('.hoverB0x:eq(' + i + ')').html('<a style="background:white;" class="imageLink" href="${createLink(uri: "/beirat/")}">Profil von' + values[i].name+'</a>');
        $('div.name:eq(' + i + ')').html(title[i]+' '+values[i].name);
        $('div.description:eq(' + i + ')').html(values[i].funktion);
        $('a.imageLink:eq(' + i + ')').prop('href', 'beirat/'+values[i].ident);
        $('a.contentLink:eq(' + i + ')').prop('href', 'beirat/'+values[i].ident);
        $('.profilBildInner:eq(' + i + ') img').attr('src', base+values[i].ident+'.png');
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got the following piece of Jquery: $(#collapse-menu > li > a).click(function() { $(this).toggleClass(expanded).toggleClass(collapsed).find(+
I think this should be simple. Say I've got the following jQuery: $someForm.live('submit', function(event)
i've got an array like following [jQuery('div#example1'), jQuery('div#example2'), jQuery('div#example3'), jQuery('div#etcetera')] Goal elementArray = [jQuery('div#example1'),
I've got the following below XML and would like to parse this with JQuery
All, I've got the following jQuery code: jQuery.post(site_url + save_data.php, jQuery(this).serialize(), function(data) { //alert(Data
All, I've got the following jQuery code: jQuery(.select_it).click(function(e){ e.preventDefault(); song_id = jQuery(this).attr('href'); music_choice =
I've got the following jsp page and I'm using struts2-jquery-plugin-3.1.1 <script type=text/javascript> function openDialog()
I got the following code : <script type=text/javascript> jQuery(document).ready(function(){ var Opened = false; jQuery('.expend-schedule').click(function(e){
I've got the following code: <code><html> <body><br> <script type=text/javascript src=http://code.jquery.com/jquery-1.4.2.min.js /> <script type=text/javascript> alert(debug);
All, I've got the following code: var site_url = 'http://localhost/website/'; jQuery(#cancel_song_choice).click(function(event){ cancel_url = site_url

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.