Kristina88
Kristina88

Reputation: 57

JavaScript reset event

<a id="LoadButton">load</a>
    $('#LoadButton').click(function () {
        ...
        ...
    }).appendTo(div);
    $('<br/>').appendTo(div);
    });

    $("#leftGrid").append(div);

After click I append data into 'leftGrid' div.

Everything works great! The problem is that if you will click twice on the load link button the data will be append twice... 3 clicks will append 3 times... how can I set the link button to reset the div before every load?

Upvotes: 0

Views: 410

Answers (1)

MicBehrens
MicBehrens

Reputation: 1798

Is your #leftGrid a DIV?

Try

$("#leftGrid").html(div);

This is replace all html inside #leftGrid with the variable div's valuables

Upvotes: 3

Related Questions