<!DOCTYPE html>
<form>
<div aria-label="button1" role="button" aria-pressed="false"></div>
<div aria-label="button2" role="button" aria-pressed="true"></div>
</form>
<script>
function go() {
document.querySelector('div[aria-label=button1]').setAttribute('aria-pressed', true);
document.querySelector('div[aria-label=button2]').setAttribute('aria-pressed', 'mixed');
}
</script>