Skip to content
Advertisement

Code randomly choosing div class after else

I have my first half of the code which is supposed to be post with thumbnail in classes. One is class item a and other is class item b. But after “else” the code takes the same class item a even if I haven’t put it around the code. Why does this happen?

JavaScript

The first article is with thumbnail and other is without thumbnail on the image.

enter image description here

Advertisement

Answer

One of your div opening tag is outside your if statement, and the closing tag is inside.

JavaScript

In the following snippet, I’ve corrected your error in a minimal version, just put your content back inside.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement