M
M
myaca2017-08-21 20:05:35
css
myaca, 2017-08-21 20:05:35

How to get the number of the clicked element in js?

https://jsfiddle.net/crmyc4d1/2/
I want to make tabs on pure js, with an unknown number of tabs and content data, in case a few more are added
to jq, there is a useful index function...
I'm thinking how to do the same on native js?
I'm thinking of doing something like... add data-* to some clicked element, and then count from the first element until I encounter that data-*
How would you do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vadim Bogomazov, 2019-04-23
@bogomazov_vadim

FullPage will probably do , it's the one used on the site above.

A
Alexey Yarkov, 2017-08-21
@myaca

https://jsfiddle.net/yarkov_aleksei/crmyc4d1/3/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question