How to make a button active by default in jquery?

How to make a button active by default in jquery?
By visiting this page subjay.ru/portfel- button "All Showing" must be active(changes color), how to do it?
September 26th 19 at 07:06
6 answers
September 26th 19 at 07:08
isn't it easier initially, the first button to give the class "selected" ?
September 26th 19 at 07:10
Approximately
<a href="#" class="b-button">Button</a>
$('.b-button').addClass('b-button_active');
.b-button_active {
background: green;
}
September 26th 19 at 07:12
Add class .selected probably
.addClass('selected')
September 26th 19 at 07:14
jQuery ('a[data-option-value=".all-showing"]').addClass('selected');
September 26th 19 at 07:16
$('a[data-option-value="all-showing"]').click();
September 26th 19 at 07:18
Something like that. But for your home to tighten it is necessary that by clicking the select button has changed.
$(document).ready(function(){
$('button selector').addClass('your class active');

$('button selector').click(function(){
$(this).addClass('your class active').siblings('button selector').removeClass('your class active');
})
})

Find more questions by tags jQuery