I want to set float values for the first three li present in my HTML using javascript. I have named the parent ul as “something”. Is it possible to set the float attribute for these li without naming them?
I want to set float values for the first three li present in my
Share
Sure, you can find the unnamed li elements in pure javascript using this snippet:
Where something is the name of the parent.
Then you access the first three children as usual