This will detach all of those dealerContainers, then append them back in their correct locations.
$('.dealerContainer[data-state]')
.detach()
.each(function(i,e) {
var state = $(e).data('state');
var stateh5 = $('h5[data-state='+state+']');
$(e).insertAfter(stateh5);
})