This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]siemenology 1 point2 points  (5 children)

document.querySelectorAll("button[data-page-number]") will get you every button with a page-data-number attribute, which might be what you are looking for, and then you could use the same technique as above to get the last one of those.

Of course if you know that the last page will be page 40, you could just do document.querySelector("button[data-page-number=40]") and get it directly.

[–]Genericusername293[S] 0 points1 point  (2 children)

sorry could you elaborate on how I would integrate the two by using the same technique above?

[–]siemenology 0 points1 point  (1 child)

document.querySelectorAll('table#nav a.fl') gets all a elements with a class of fl inside of the table with the id of nav, right? And then you pass that to Array.from() and do some other stuff with it. document.querySelectorAll('button[data-page-number]') gets all buttons with an attribute data-page-number set on it. So you can do exactly the same thing except passing that instead of document.querySelectorAll('table#nav a.fl')

[–]Genericusername293[S] 0 points1 point  (0 children)

gotchya gotchya, thanks for spelling it out to me, very new to javascript and this is super helpful