I have this Array: [home, info, mail,,,, something, stuff, other]
But I want to remove or replace the ,, with ,
I tried: allIDs.replace(",,", ","); But it doesn’t seem to work with Arrays
The reason there are empty entries is this:
$(document).find('DIV').each(function(){
allIDs.push(this.id); })
I’m indexing all DIV’s ID names, to check if there are duplicates and then rename the currently generated DIV ID..
Alternatively I’d like to find() only the DIV’s that have an ID defined..
Change your
idgathering to this…If there’s no ID on the
DIV,undefinedwill be returned, and nothing will be added to the resulting Array.