Using querySelector is generally okay. But it's important to consider the following: if one day you decide to rewrite your classes, as is common during a layout redesign, the changes might break your scripts. I recently had this issue. Now I understand the advantage of using getElementById whenever possible. And at the CSS level, using classes instead of IDs.