<script> window.addEventListener("load", function() { let form = document.querySelector("form"); form.addEventListener("submit", function(event) { let usernameInput = document.querySelector("input[name=username]"); let teamName = document.querySelector("input[name=team]"); if (usernameInput.value === "" || teamName.value === "") { alert("All fields are required!"); // stop the form submission event.preventDefault(); } }); }); </script>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter