开发者

appendTo does not work on ajaxForm in success:

开发者 https://www.devze.com 2023-01-28 03:54 出处:网络
I want to append quest1 to #adder, but just does not happen $(\'#formnam\').ajaxForm(function() { var quest = $(\'#Text\').attr(\'value\');

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消