-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autocompletion off + button "Play" #38
Conversation
index.html
Outdated
@@ -47,7 +47,7 @@ | |||
</div> | |||
|
|||
<div id='startGame' class="secondColumn spanInPortrait disableWithPopUpScreen"> | |||
<input type='button' id='startGameButton' class="buttonWithText" value='PLAY'> | |||
<input type='button' id='startGameButton' class="buttonWithText" value='PLAY' autocomplete='off'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool and easy 😌
src/app/App.js
Outdated
document.querySelector('#enterYourNameInput').addEventListener("change", () =>{ | ||
document.querySelector("#startGameButton").addEventListener("click", () => { | ||
const userName = document.querySelector('#enterYourNameInput').value; | ||
renderQuizPage(SELECTED_MODE, userName, options.quizMaxTime) | ||
}); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a good approach. By this way you will be adding new event listener to #startGameButton every time you change something on name input. If somebody will write 1000 letters there -> then there will be 1000 listeners that will render quiz page. Not good :)
Better approach is look at this:
https://stackoverflow.com/questions/7067005/disable-button-whenever-a-text-field-is-empty-dynamically
- make "PLAY" button disabled by default.
- add "onkeyup" (not sure about exact name) event listener to the "name input" that will execute something like this:
function stoppedTyping(){
if(this.value.length > 0) {
document.getElementById('start_button').disabled = false;
} else {
document.getElementById('start_button').disabled = true;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
No description provided.