updated
At the beginning, when I click button, item from function checkinforfun loop again and again. And I wish to delete the previous to prevent it only show once.
OK now, so far i have found one way to not "delete" , is to change append to html , but when I change to html all item in function checkinforfun doesn't show completely
if (i === checkin_info.length - 1) {
$(".checkin_progress").append(check_progress_day);
} else {
$(".checkin_progress").append(check_progress_day + check_progress_dot1 + check_progress_dot2 + check_progress_dot3);
}
asked Jan 19, 2015 at 3:06
FeelRightz
3,0092 gold badges45 silver badges82 bronze badges
1 Answer 1
One way of doing this would be emptying the div that has a class named checkin_progress.So each time you click on the button it will clear the previous html content and your function adds the new content.
$(".checkin_progress").empty();
$.each(checkin_info, function (i, obj) {
//Other code;
}
FYI
answered Jan 19, 2015 at 4:41
Nibin
3,9502 gold badges22 silver badges40 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-js
htmlit doesn't show completely because everytime the new data replaces the old one..appendevery time i clicked , item will keep adding again and again