Pagination functionality: I am looking to modify the background color when a user clicks on any element within an array. Currently, the code below allows me to achieve this effect. However, I would like the previously clicked element and all other elements in the array to revert back to their original styling with the class pagins
. Any suggestions on how I can accomplish this?
.pagins a {
color: #fff;
background-color:#009de0;
}
.testClass {
background-color:#fff !important;
color:#009de0 !important;
}
var elements = document.getElementsByClassName('pagins');
$.each(elements, function(){
$(elements).click(function(){
$(this).addClass('testClass');
});
})