19 lines
727 B
JavaScript
19 lines
727 B
JavaScript
function selectRating(question, rating) {
|
|
// Desmarcar todos los botones de esta pregunta
|
|
document.querySelectorAll(`button[onclick^="selectRating('${question}'"]`).forEach(btn => {
|
|
btn.classList.remove('selected');
|
|
});
|
|
|
|
// Marcar el botón seleccionado
|
|
event.target.classList.add('selected');
|
|
|
|
// Actualizar el valor en el input hidden
|
|
document.getElementById(`${question}_rating`).value = rating;
|
|
}
|
|
|
|
document.getElementById('surveyForm').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
// Aquí iría el código para enviar los datos del formulario
|
|
// Y redirigir al usuario a la siguiente pantalla
|
|
window.location.href = "datos-demograficos.html";
|
|
}); |