Hi,

my source looks like this:

<table width="100%" border="0" id="edit_categories">
<tr>
        <td colspan="3" align="right"><a href="/admin/index.php?
action=categories&function=add&sub=add">Neu hinzufügen</a> <br /> <br /
></td>
</tr>
<tr style="background-color: #EEEEFF;">
        <td>
        <span class="name_1" style="font-weight:bold">Packstoff und
Packmittel aus Aluminium</span>
        <div class="edit_box_1">
        <input type="text" name="new" id="feld_1" size="50"
class="editfield" />
        <div></div>
        <input type="button" name="savebutton" id="button_1" value="Änderung
speichern" />
        </div>
        </td>
        <td align="center"><a href="/admin/index.php?
action=categories&function=delete&prg_id=1" onClick="return confirm
('Wirklich löschen?')"><img src="../img/delete.png" alt="" width="16"
height="16" border="0" /></a></td>
        <td align="center"><a href="#"><img class="open_edit_box" id="1"
src="../img/edit.png" alt="" width="16" height="16" border="0" /></a></
td>
</tr>

<tr style="background-color: #FFFFFF;">
        <td>
        |&nbsp;--&nbsp;<span class="name_96" >Aluminium - Siegelrandschalen</
span>
        <div class="edit_box_96">
        <input type="text" name="new" id="feld_96" size="50"
class="editfield" />
        <div></div>
        <input type="button" name="savebutton" id="button_96" value="Änderung
speichern" />
        </div>
        </td>
        <td align="center"><a href="/admin/index.php?
action=categories&function=delete&prg_id=96" onClick="return confirm
('Wirklich löschen?')"><img src="../img/delete.png" alt="" width="16"
height="16" border="0" /></a></td>
        <td align="center"><a href="#"><img class="open_edit_box" id="96"
src="../img/edit.png" alt="" width="16" height="16" border="0" /></a></
td>
</tr>
......

My jquery:

if ( $("#edit_categories").length > 0 ) {
                // close all by default
                $('.edit_categories>tr>td>div').hide();
                $('.open_edit_box').click(function(){
                        var prg_id = this.id;
                        // close all
                        $('.edit_categories>tr>td>div').hide();
                        // open requested one
                        $('.edit_box_'+prg_id).show();
                });

        }



For some reason, the first table row stays always open... the second
(and all following) are closed.
What I do wrong? Is there a better way? I decided for this way, as I
don't Know the div names, as they get filled by database id's.

Thanks for help!

Heidi

Reply via email to