Ajax replace instead of append Ajax replace instead of append jquery jquery

Ajax replace instead of append


you could empty the element before you append

$("#results").empty().append(myHtml);

or use the html method

$("#results").html(myHtml)


Just change

$('#results').append(myHtml);

to

$('#results').html(myHtml);


ok, last entry 2009, but if the problem still exist:
$("#results").replaceWith(yourContent)