appendTo does not work on ajaxForm in success:
I want to append quest1 to #adder, but just does not happen
$('#formnam').ajaxForm(function() {
var quest = $('#Text').attr('value');
var quest1 = '<div>'开发者_如何学运维+$('#Text').attr('value')+'</div>';
$.ajax({
type: "post",
url: "submit.php",
data: "q="+quest,
success: function() {
$('#Adder').html(quest1);
}
});
});
It works if I use .text or .html, but I want appendTo.
Does not work on chrome, IE, ff
Thanks Jean
.html()
does indeed overwrite the html content from #Adder
. If you want to append new stuff, use .append()
instead.
Ref.: .append(), .html()
use append
, appendto
appends to the parameter.
http://api.jquery.com/appendTo/
精彩评论