jQuery change elements within div -


i'm stuck kinda stupid problem. saw examples of problem, seems can't find correct loop. in 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 part of php script $id taken database. ids numeric, table ids differ number, eg.:

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

all tables taken database , shown within loop. ids can deleted, order 1,3,4,6 , on. there's 1 hidden table known $id = 'zero', eg.:

<tr id="borderzero"> 

there's div element id zero, within shown above table situated. problem - need change id of each element within div id zero, eg.:

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

of course can type them 1 one, i'm trying .each function, though fail , hope i'll help. here's 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 database , it's value last table id +1.

try replacing this:

if($("[id*='zero']").length > 0) 

with this:

if( this.id.match(/zero$/ig) ) 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -