Created
February 23, 2026 00:47
-
-
Save rushkeldon/c6d14eb658a2aa045cdcf313453c4d51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function whenDOMready(func ) { | |
| switch ((document.readyState + "")) { | |
| case "complete": | |
| case "loaded": | |
| case "interactive": | |
| func(); | |
| break; | |
| default: | |
| window.addEventListener("DOMContentLoaded", (e) => func()); | |
| } | |
| } | |
| function checkUsername() { | |
| const form = document.querySelector('form'); | |
| if( !form ) return Boolean( console.log( 'checkUsername : form not found' ) ); | |
| const input = form.querySelector('input[type="text"]'); | |
| if( !input ) return Boolean( console.log( 'checkUsername : input not found' ) ); | |
| if( !input.value ) return Boolean( console.log( 'checkUsername : input has no value' ) ); | |
| return true; | |
| } | |
| function clickNext() { | |
| const form = document.querySelector('form'); | |
| if( !form ) return Boolean( console.log( 'clickNext : form not found' ) ); | |
| const btn = form.querySelector('input[type="submit"]'); | |
| if( !btn ) return Boolean( console.log( 'clickNext : btn not found' ) ); | |
| btn.click(); | |
| return true; | |
| } | |
| whenDOMready( () => { | |
| window.setTimeout( () => { | |
| checkUsername() && clickNext() && console.log( 'successfully clicked the Next btn.' ); | |
| }, 200 ); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment