Which class do I pick in an html element that has multiple class names? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Which class do I pick in an html element that has multiple class names?

I’m inspecting on this website, and the element I’m looking at looks something like this: <div class = “b-seven txt-1 tlxd1 seven”> </div> I’m trying to use an extension where you can save your code through a JS editor. And it works. I’ve used it for a while now. I’m wondering if I should choose all the classes together like (“.b-seven txt-1 tlxd1 seven”), or choose one of those? I tried loop, and the following var elm = ...selectorAll(“.b-seven”); elm[0].style... elm[1].style. elm[2].style.

10th Jan 2020, 9:02 PM
Ginfio
Ginfio - avatar
8 Answers
+ 5
It depends on what you want. Different classes means there might be different ways of customizing them. Maybe ine class means a page number, the other one means the position in the same page... it could be anything.
10th Jan 2020, 9:16 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
Ginfio it definitely does matter. You should see more than just one element, and compare which elements have the same classes, and what are the caracteristics that they have in common.
11th Jan 2020, 12:21 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
Ginfio Is the website publicly avaliable for us to review for a closer look?
11th Jan 2020, 12:29 AM
David Carroll
David Carroll - avatar
+ 3
What is it you want to do exactly ? Type the words fast ?
11th Jan 2020, 1:50 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
the extrnsion i’m talking about is a chrome extension called ‘Codify’. I’m trying to get an element from this specific website, so i can use edit it’s style | text through the extension. But, this div element i’m talking about is being difficult to get through JS.
10th Jan 2020, 9:05 PM
Ginfio
Ginfio - avatar
0
Aymane Boukrouh [INACTIVE] So does it matter which element I choose through JS? Could I pick one of them and use them as a DOM or to style in jS...
11th Jan 2020, 12:01 AM
Ginfio
Ginfio - avatar
0
David Carroll Yes. I think I just figured out why it isn't working. On the website, of course like any websites, it has multiple pages. And the first element I've worked on, it's on the "garage" page. and when you click on garage, it automatically LOADS everything, so the element in the garage that I've changed the style to - will load in as the page loads too. But the element I'm struggling with right now: the game is a typing game, and when you press race it loads the page where you race. At the end, the score is not really being loaded like a new page would be loaded. The score just pops up like ... scorePage.display = 'block'; The score page doesn't really get loaded with the race. So probably because it doesn't load, the changes I've made don't take effect. The game is called nitro type (I didn't make it) If you are wanting to see the website, or what I'm talking about: the game is: https://www.nitrotype.com/race qualify for race, then race as guest racer, then the score page pops up. the element is at the bottom under Your Cash ("$0"); > inspect class = "tc-emerald tsxl tlh-1"
11th Jan 2020, 1:46 AM
Ginfio
Ginfio - avatar
0
Aymane Boukrouh [INACTIVE] no. I wish. I've more than $0, since I have an account, but I want to be able to change the innerHTML of that element to anything like... "100,000". That doesn't mean I have "$100,000". Just for the view. For example if I have "$1,500", that is what the value of that element | variable is, but just shows as "100,000". --
11th Jan 2020, 1:59 AM
Ginfio
Ginfio - avatar