table jquery problem
table jquery problem
Hi folks
I want to append a row in my table with jquery. The append works but it must be possible to edit that row. I can edit the other rows, but I can't edit the newly added row.
Here is my code:
for adding my article to the table:
- $.post('./addArticle.php',{articleid: articleid, info: info, code: code, price: price},function(data){
- if(data != ""){
- $('#addArticle').fadeOut('fast');
- $('#overlay').fadeOut('fast');
- $('#artTable').append(data,function(){
- $(this).effect("highlight", {"color": "#313131"}, 1000);
- });
- }
- })
My addArticle.php contains my insert to the database and gives as response my row that it must append + a hidden field with an id. I use this ID to edit my article.
- echo "<input type='hidden' value='$articleid' class='articleid' />";
- echo "<tr>";
- echo "<td id='article'>$articleid</td>";
- echo "<td id='info'>$info</td>";
- echo "<td id='code'>$code</td>";
- echo "<td id='price'>$prijs</td>";
- echo "<td id='field'><input type='checkbox' id='active' value='1' checked='true' /></td>";
- echo "<td><button type='button' id='editArticle'><img src='../images/Edit-icon.png' /></button></td>";
- echo "</tr>";
But I can't edit my last added record. After a complete refresh it works, but that is not what I want.
Can somebody help me?