<script src="http://code.jquery.com/jquery-latest.js"></script>
<div class="alert">
<button type="button" class="close" data-dismiss="alert">×</button>
<span>Err1</span>
<span>Err3</span>
<span>Err2</span>
<span>Err3</span>
<span>Err2</span>
</div>
<script type="text/javascript">
var obj={};
$('div.alert > span:contains("Err")').each(function () {
obj[$(this).html()]=$(this).remove();
});
for (var i in obj){
$('div.alert').append((obj[i]))
};
</script>