$( document ).ready(function() {
var timer_ = setInterval(
function(){
if ($('#motivoSolicitud option[value="47"]').length==1) $('#motivoSolicitud option[value="47"]').remove();
else clearInterval(timer_);
}, 1000);
});
// Función para habilitar o deshabilitar el botón
function toggleButton() {
const selectTipoAdjunto = document.getElementById('tipoAdjunto');
const ficherosList = document.getElementById('ficherosList');
const buttonAdjuntar = document.getElementById('adjuntar');
// Habilita el botón solo si el select tiene un valor seleccionado Y hay archivos en la lista
if (selectTipoAdjunto.value !== '' && ficherosList.getElementsByClassName('fileImage').length > 0) {
buttonAdjuntar.disabled = false;
} else {
buttonAdjuntar.disabled = true;
}
}
// Agregar event listener al select
document.getElementById('tipoAdjunto').addEventListener('change', toggleButton);
// Observar cambios en el div ficherosList
const observer = new MutationObserver(toggleButton);
observer.observe(document.getElementById('ficherosList'), { childList: true, subtree: true });
// Llamar a la función inicialmente para establecer el estado correcto del botón
toggleButton();
// ]]>