48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
|
|
|
|
// function change(){
|
|
// if (document.getElementById('radio1').checked && document.getElementById('radio2').checked == false){
|
|
// linkTao.style.display = 'block';
|
|
// textTao.style.display = 'none';
|
|
// console.log(1)
|
|
// }
|
|
// else if (document.getElementById('radio1').checked == false && document.getElementById('radio2').checked){
|
|
// textTao.style.display = 'block';
|
|
// linkTao.style.display = 'none';
|
|
// console.log(2)
|
|
// }
|
|
// else{
|
|
// textTao.style.display = 'none';
|
|
// linkTao.style.display = 'none';
|
|
// console.log(3)
|
|
// }
|
|
// }
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
const radio1 = document.getElementById('radio1');
|
|
const radio2 = document.getElementById('radio2');
|
|
const linkTao = document.getElementById('inputLink');
|
|
const textTao = document.getElementById('inputText');
|
|
|
|
function toggleInputs() {
|
|
if (radio1.checked) {
|
|
linkTao.style.display = 'flex';
|
|
textTao.style.display = 'none';
|
|
console.log(1);
|
|
} else if (radio2.checked && radio1.checked == false) {
|
|
linkTao.style.display = 'none';
|
|
textTao.style.display = 'flex';
|
|
console.log(2);
|
|
} else {
|
|
linkTao.style.display = 'none';
|
|
textTao.style.display = 'none';
|
|
console.log(3);
|
|
}
|
|
}
|
|
|
|
linkTao.style.display = 'none';
|
|
textTao.style.display = 'none';
|
|
|
|
radio1.addEventListener('click', toggleInputs);
|
|
radio2.addEventListener('click', toggleInputs);
|
|
}); |