Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Book said don't use CSS IDs, use class instead but what about when Javascript? Reply To: Book said don't use CSS IDs, use class instead but what about when Javascript?

#182351
TC
Participant

Hi guys, and thanks to all of you : __, Alen, Senff, and shaneisme :)

__ you scored a direct hit, lol.

You guys are right I need to read / learn more. I should of known about document.getElementsByClassName.

The problem isn’t that I’m lazy but I’ve got something wrong with my eyes where I can only be on a computer screen or digital screen for a little while before my eyes get pressurized, hurt, bloodshot, etc. I think it’s because I have an astigmatism. I may need to get reading glasses.
The problem gets so bad that I’m woken up in the middle of the night from pressurized eyes / eye pain and my eyes are totally red.

Have any of you heard about these problems? If so any solutions you can suggest?
You guys must put in long hours on the computer. These eye problems are ruining my life!
I’m taking eye vitamins, trying eye exercises, but still can’t handle the computer / tv screen.

CSS3: The Missing Manual by David Sawyer McFarland.
It covers a lot of CSS which is great but I don’t like the author’s writing style.

For Javascript I’m reading : A smarter way to learn Javascript by Mark Myers. This is a great book and a great way to learn Javascript.

I have the kindle (small screen) versions of them and it’s probably a little more difficult to read on than having actual books. Love my kindle for it’s portability but I find when learning coding I’m wanting actual books.

The book (which book?) probably meant that it’s OK to give IDs to elements, and to target them with JavaScript, but to not use IDs for styling. In other words, avoid calling any ID in your CSS file because of their high specificity weight.

Senff I think you nailed it.

You guys are awesome, thank you very much !