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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:18:20+00:00 2026-05-20T06:18:20+00:00

I’m stuck with this kinda stupid problem. I saw examples of my problem, but

  • 0

I’m stuck with this kinda stupid problem. I saw examples of my problem, but it seems I can’t find correct loop. In any case, I’ll better provide examples:

<table border="1" id="inline" class="<?=$id?>" style="background:none;">
    <tr id="border<?=$id?>">
        <td rowspan="2" style="max-width:420; width:420" valign="top">
            <form id="feedback<?=$id?>" <? if(!$check){?>style="display:none"<? }?>>
                <textarea cols="40" class="editor" id="editor<?=$id?>" name="editor1" rows="10"><?=$text?></textarea>
                <table style="background:none"><tr><td><input type="button" value="Save" id="submit<?=$id?>"></td><td><img id="spinner<?=$id?>" height="25" style="display:none"></td></tr></table>
            </form>
            <div id="content<?=$id?>"<? if($check){?> style="display:none"<? }?>><?=$text?></div>
        </td>
        <td style="border-width:0">
            Title:<br>
            <div id="title_div<?=$id?>"<? if($check){?> style="display:none"<? }?>><?=$title?></div><input type="text" id="title<?=$id?>" value="<?=$title?>"<? if(!$check){?> style="display:none"<? }?>>
        </td>
    </tr>
    <tr>
        <td style="border-width:0" valign="top">
            <div id="uploader<?=$id?>"<? if(!empty($img)){?> style="display:none<? }?>">
                <input id="upload<?=$id?>" name="upload" type="file" />
            </div>
            <div id="div_holder<?=$id?>">
            <? draw_buttons($id);?>
            <a title="<?=$title?>" <? if(!empty($img)){?> href="images/people/<?=$img?>"<? }?> id="feedback_img<?=$id?>" class="lightbox"><img border="0"<? if(!empty($img)){?> src="images/people/timthumb.php?src=<?=$img?>&w=200&q=100"<? }else{?> style="display:none"<? }?> id="img_holder<?=$id?>"></a></div><img id="jcrop<?=$id?>" style="display:none" />
        </td>
    </tr>
</table>

This is a part of my php script where $id is taken from database. Ids are numeric, so all table ids differ only with a number, eg.:

<tr id="border1">
//next table tr
<tr id="border2">

All tables are taken from database and shown within a loop. Ids can be deleted, so their order could be 1,3,4,6 and so on. But there’s one hidden table with known $id = ‘zero’, eg.:

<tr id="borderzero">

There’s also div element with id zero, within which shown above table is situated. So my problem is – I need to change id of each element within that div with id zero, eg.:

<tr id="borderzero">
//change to
<tr id="border5">

Of course I can just type them one by one, but I’m trying with the .each function, though I fail and I hope I’ll get some help. Here’s what I came with:

$("div#zero").clone().attr({'id' : feedback_id}).appendTo("#temp_holder").fadeIn('slow');
$('#' + feedback_id + ":not(td)").contents().each(function() {
        if($("[id*='zero']").length > 0){
                var new_id = $(this).attr('id');
                new_id = new_id.replace('zero', some_id);
                $(this).attr({'id' : new_id});
            }
    });

Var feedback_id through ajax taken from database and it’s value is last table id +1.

  • 1 1 Answer
  • 1 View
  • 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-20T06:18:21+00:00Added an answer on May 20, 2026 at 6:18 am

    Okay I found a way to actually get all the elements. First answer was helpful, thank you, but also had to change .contents() to .find(‘*’). So the working script looks like this if somebody would require it:

    $("div#zero").clone().attr({'id' : feedback_id}).appendTo("#temp_holder").fadeIn('slow');
    $('#' + feedback_id + ":not(td)").find('*').each(function() {
            if(this.id.match(/zero$/ig)){
                    var new_id = $(this).attr('id');
                    new_id = new_id.replace('zero', some_id);
                    $(this).attr({'id' : new_id});
                }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the 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.