bridgy-fed/static/index.js

22 wiersze
553 B
JavaScript

/**
* Code for the home page protocol picker.
*/
function update() {
// show matching instructions
// console.log($('.instruction'))
for (instr of $('.instruction')) {
let parts = instr.id.split('-')
let me = parts[1]
let them = parts[2]
// console.log(me, them, $(`#me-${me}`)[0].checked, $(`#them-${them}`)[0].checked)
instr.style.display =
($(`#me-${me}`)[0].checked && $(`#them-${them}`)[0].checked)
? 'block' : 'none'
}
}
addEventListener('DOMContentLoaded', () => {
$('input').on('change', update)
})