X10nD
X10nD

Reputation: 22040

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

Upvotes: 0

Views: 203

Answers (2)

Daniel
Daniel

Reputation: 2381

use append, appendto appends to the parameter. http://api.jquery.com/appendTo/

Upvotes: 1

jAndy
jAndy

Reputation: 236092

.html() does indeed overwrite the html content from #Adder. If you want to append new stuff, use .append() instead.

Ref.: .append(), .html()

Upvotes: 2

Related Questions