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.
8 RĂ©ponses
+ 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.
+ 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.
+ 3
Ginfio Is the website publicly avaliable for us to review for a closer look?
+ 3
What is it you want to do exactly ? Type the words fast ?
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.
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...
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"
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".
--