mardi 31 janvier 2017

Only the first if statement is executing in jQuery

I have two jQuery if statements that perform a remove() from a submenu. They work fine if there is only one true statement, but if there is an id1 & an id2 on the page, only the first if triggers.

if ($('#id1').length==0) { $('#submenu li').eq(2).remove();}

if( $('#id2').length==0) { $('#submenu li').eq(3).remove();}

Aucun commentaire:

Enregistrer un commentaire