[JavaScript] Bloquear botón de enviar en formulario mientras se envía.

Cuando le damos al botón enviar cabe la posibilidad de darle clic doblemente, para evitar este suceso se suele bloquear el botón durante unos segundos para que sea enviado, aquí va el código.

HTML:

<form name="miformulario">
<input type="submit" name="btnEnviar" value="Enviar" />
</form>

JavaScript:

function confirmEnviar() {
miformulario.btnEnviar.disabled = true;
miformulario.btnEnviar.value = "Enviando...";
setTimeout(function(){
miformulario.btnEnviar.disabled = false;
miformulario.btnEnviar.value = "Enviar";
}, 3000);
return false;
}

miformulario.btnEnviar.addEventListener("click", function(){
return confirmEnviar();
}, false);
PandaGG
Lok'tar ogar

1 Comentario

Dejar respuesta

Please enter your comment!
Please enter your name here

Sponsor

Últimos

Themenslots mit Ägypten Motiv

EinführungThemenslots mit Ägypten Motiv sind ein faszinierendes Segment der Online-Spielautomaten, das die reiche Kultur und Geschichte Ägyptens in den Mittelpunkt stellt. Diese Spielautomaten sind...

Yabby Casino Customer Support: How Players Can Get Help with Account and Payment Questions

IntroductionIn the world of online gaming, customer support plays a crucial role, especially for beginners navigating platforms like Yabby Casino. Understanding how to access...

Casino en ligne retrait express : Guide complet pour les parieurs expérimentés

IntroductionLe monde des jeux d'argent en ligne a évolué de manière significative ces dernières années, et le concept de retrait express est devenu un...

Royal Panda Casino Review for Canadian Players

IntroductionRoyal Panda Casino has emerged as a popular online gaming destination for players in Canada. With its user-friendly interface and a wide variety of...

Exploring the Different Gaming Categories Available on Roobet

IntroductionRoobet is an online gaming platform that has gained popularity among players in Canada. It offers a variety of gaming categories that cater to...