I have 3 li’s with all a data-panename.
I want a random li to be selected every refresh.
How to make a javascript/jQuery script to make a random data-panename get the class active?
HTML
<ul class="tab-tabs">
<li class="first" data-panename="uitgelicht"><a href="/nl?show=Uitgelicht" rel="nofollow">Uitgelicht</a></li>
<li data-panename="nieuw"><a href="/nl?show=Nieuw" rel="nofollow">Nieuw</a></li>
<li class="last" data-panename="meest-bekeken"><a href="/nl?show=Meest+bekeken" rel="nofollow">Meest bekeken</a></li>
</ul>
You can do this :
Demonstration (reload to see a different li in red)