Instead of appending all alert messages together show only latest one and remove all the previous alerts

StackOverflow https://stackoverflow.com/questions/23252652

문제

enter image description here

I want to remove all the old alerts and show only the latest one.

The code snippet that is adding these alerts:

$("#update-timeline-audit").parent().after('<div class="alert alert-success inline"> <a href="#" class="close" data-dismiss="alert">&times;</a>No new tweets since the last audit</div>');

Please suggest me a way to solve this repitition of alerts issue! Thanks in advance!

도움이 되었습니까?

해결책

Try using .html() instead of .after()

.after() appends the HTML each time while .html() resets the HTML each time.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top