hello i am new here and i hope i don`t post in a wrong place
the problem is like this:
i use a .getJson to retrive results from a database.
and the results are appendet to a table [multiple rows] once i click to a img it loads a detailed view of the data into a div(or another table).
my problem is the following:
i must remove the old content of the detailed div – only the appendTo part –
the code looks somethink like this:
script:
$("button.#results").click(
function(){
$.getJSON(dataretrive.php?callback=?&query=1' ,
function(data) {
$.each(data, function(i, item) {
var mindata = "<tr><td class='border'>" +data[i].name+ "</td>";
.... [minimal data]
$(mindata).appendTo("table.#shorttableinfo");
var detailfull = "<tr valign='top' height='25' width='100px'><td> Name: </td><td>" + data[i].name + "</td></tr>"
... [lots of data]
$("img.#editrow" + i ).click(
function(){
$(detailfull).appendTo("table.#detailsfull");
});
});
});
});
the html:
[html code]
<table id="shorttableinfo"> // i need a small table here
<tr><td>Name:</td><td> [other minimal data] </td></tr>
</table>
[other html code]
<table id="detailsfull"> // i need a small table here
<tr><td>Name:</td><td> [other minimal data] </td></tr>
</table>
my problem is that i need the code to be removed before jquery loads the new data into the tablbe with id detailsfull, without removing the first row of the table.
Your selector is invalid on
appendTo(), should beappendTo("table#shorttableinfo")You can remove your rows via
The above will remove all rows but the first one out of your
detailsFulltable