I have tried to make a pager in where I can click on a page number, the color then turns to grey. But it seems to fail miserably. Why is this code not making the pager number that's clicked on grey? I'm trying to fix it now hopefully it will work.
function my(i) {
document.getElementsByClassName('number')[0].removeAttribute("id");
i.id = "act";
}
.pager li.active > a:active {
color: grey !Important;
}
.pager > li > a.right-arrow {
margin-left: 410px;
width: 30px;
border-radius: 50%;
box-shadow: 0px 0px 5px #9ecaed;
font-size: 15px;
padding: 7px;
line-height: 1;
}
.pager > li > a.left-arrow {
margin-right: 410px;
width: 30px;
border-radius: 50%;
box-shadow: 0px 0px 5px #9ecaed;
font-size: 15px;
transform: rotate(180deg);
padding: 7px;
line-height: 1;
}
.number {
border-color: white !Important;
padding: 5px !Important;
}
a {
color: black !Important;
}
#act {
color: red !Important;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="text-center">
<ul class="pager">
<li><a href="#" class="left-arrow">➜</a></li>
<li><a href="" class="number" id="act" onclick='my(this);'>1</a></li>
<li><a href="" class="number" onclick='my(this);'>2</a></li>
<li><a href="" class="number" onclick='my(this);'>3</a></li>
<li class="number">...</li>
<li><a href="" class="number" onclick='my(this);'>7</a></li>
<li><a href="" class="number" onclick='my(this);'>8</a></li>
<li><a href="" class="number" onclick='my(this);'>9</a></li>
<li><a href="" class="right-arrow">➜</a></li>
</ul>
</div>