i have table with id myTable

first tr is like:

<tr bgcolor=#ff9966 id='0'>
            <td>Skill</td>
            <td>Skill Type</td>
            <td>Total Experience Year</td>
            <td>Total Experience months</td>
            <td>Last Used In</td>
            <td>Description</td>
            <td>Modify</td>
</tr>

when I am inserting values of one array into this table using for loop with below code:

    var html="";
    var tr_id=/* I HAVE CALCULATED THIS VALUE. IT IS NEXT TO (LAST TR VALUE) of myTable */
 for (var index=0;index < global_arrayLength;index++)
    {
    // HERE I WANT TO REMOVE THE PREVIOUS TRs FROM SECOND TR
        html+='<tr id='+tr_id+'>';
        for(inner_index=5;inner_index >= 0;inner_index--)
        {   
            html+='<td>'+skill_array[index][inner_index]+'</td>';             
        }
        html+='<td><a onClick=edit_skill('+tr_id+');>'+EDIT+'</td>';
        html+="</tr>";       
    }   
    $(html).appendTo('#myTable');

but what happens it,
it is inserting / appending values to present myTable.
So first i want to clean (remove) all values from myTable except than first TR (in which I have written table headers)
How can I do this
In jQuery ??

I guess something like this should work:

$('table#your_table_id tr').not(':first').remove();

Thanks
worked for me :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.