JavaScript
Article
By Sam Deering

jQuery Find and Remove Duplicated Element IDs

By Sam Deering

This example could be used to fix a featured article for your blogs so that not more than one article is featured on the homepage.

--ADVERTISEMENT--

// featured article fix
var myFeatured = $('div.featured').attr('id');
var theHidden;
$('div.article').each(function(){
	theHidden = $(this).attr('id');
	if(theHidden == myFeatured){ 
		$('div#'+theHidden).hide();	
	}
});
Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account