Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

All comments

  • Akanksha 80

    @akankshav108

    Submitted

    Can someone tell me what is the difference when we do element.style.display = "block"; vs element.classList.add("show") where show is css class => .show{ display:block; }. Why do these two behave differently?

    Also if you go through my code, please let me know if there is anything I can improve in HTML, CSS or JavaScript. I welcome all suggestions.

    @Rexer-Glitch

    Posted

    There shouldn't be any difference between the 2 approaches. Though I would prefer using classes to change styles since this obeys the separation of concerns - Javascript should be only for logic, not for applying styles. It's a better approach in my experience.

    Marked as helpful

    0