Notes
![]() ![]() Notes - notes.io |
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Professional Number Input Validation</title>
<style>
/* Reset some default styles */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(135deg, #e0eafc, #cfdef3);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background: white;
padding: 40px;
border-radius: 10px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
text-align: center;
width: 350px;
transition: transform 0.3s;
}
.container:hover {
transform: scale(1.02);
}
h1 {
font-size: 28px;
margin-bottom: 20px;
color: #333;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}
input {
padding: 12px;
margin: 15px 0;
width: 100%;
border: 2px solid #007bff;
border-radius: 5px;
font-size: 16px;
transition: border-color 0.3s;
}
input:focus {
border-color: #0056b3;
outline: none;
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}
button {
padding: 12px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
width: 100%;
font-size: 16px;
transition: background-color 0.3s, transform 0.3s;
}
button:hover {
background-color: #0056b3;
transform: translateY(-2px);
}
.error-message {
color: red;
display: none; /* Hidden by default */
margin-top: 10px;
font-weight: bold;
}
.success-message {
color: green;
display: none; /* Hidden by default */
margin-top: 10px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<h1>Number Input Validation</h1>
<form id="numberForm">
<input type="text" id="numberInput" placeholder="Enter a number" required>
<button type="submit" id="submitButton">Submit</button>
<div id="errorMessage" class="error-message">Please enter a valid number!</div>
<div id="successMessage" class="success-message">Input is valid!</div>
</form>
</div>
<script>
document.getElementById('numberForm').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent form submission
const input = document.getElementById('numberInput').value;
const errorMessage = document.getElementById('errorMessage');
const successMessage = document.getElementById('successMessage');
// Reset messages
errorMessage.style.display = 'none';
successMessage.style.display = 'none';
// Check if the input is a valid number
if (isNaN(input) || input.trim() === '') {
errorMessage.style.display = 'block'; // Show error message
} else {
successMessage.style.display = 'block'; // Show success message
}
});
</script>
</body>
</html>
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team