+ 6
Take data in js
I've 4 div as tabs. when you click to once, I want to take his data and I want with this data we got, to display the page correspondant. how to take data and do this ? <div id="tabs"> <div data-page="page-1">first tab</div> <div data-page="page-2">second tab</div> <div data-page="page-3">third tab</div> <div data-page="page-4">fourth tab</div> </div> <div id="content> <div id="page-1">a</div> <div id="page-2">b</div> <div id="page-3">c</div> <div id="page-4">d</div> </div>
4 Respuestas
+ 7
it's a bit different in jQuery, take a look at this
https://stackoverflow.com/questions/5309926/how-to-get-the-data-id-attribute
+ 7
@Kamil, I saw this w3s. For the code, I can't do once now but when I can I will do it :)
just take a data, how can we do ?
like this ?
var x = $(this).getAttribute (data-page);
or
var x = $(this).getAttribute ('data-page');
+ 6
can you explain you problem a bit more and maybe create a code?
take a look at this
https://www.w3schools.com/tags/att_global_data.asp
0
Use dataset
https://code.sololearn.com/WeBhSBiZKOQq/?ref=app