Fix Issue #2042: prevent invalid input alert on backspace in Armstrong Checker #2060
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue (Number)
Closes #2042
Description
This PR fixes the invalid input alert that appeared when users pressed Backspace on an empty or single-digit input in the Armstrong Number Checker project.
The previous implementation triggered an intrusive
alert()and page reload even during normal text editing, leading to a poor user experience.Changes Made
onkeyup="textfxn()"fromarmstrong.htmlarmstrong.js⚠️ Please enter a valid positive number.)Type of change
Checklist
ATTACH SCREEN-SHOTS / DEPLOYMENT LINK
Before:
An alert popup saying “Invalid input!” appeared when pressing Backspace on empty/single-digit input.
After:
No alert interruption. Inline message appears under the input box, maintaining a smooth typing flow.
Deployment Link:
https://frontendprojects.netlify.app/projects/armstrongchecker/armstrong