Only Text Input Form with JavaScript Validation: A Step-by-Step Guide

Only  Text Input Form with JavaScript Validation: A Step-by-Step Guide

Learn how to build a text input form with JavaScript validation in this comprehensive tutorial. We'll walk you through each step of the process, from setting up the HTML structure to implementing JavaScript validation logic. By the end of this tutorial, you'll have a functional form that ensures users enter valid names. Whether you're a beginner or an experienced developer, this guide will help you enhance your HTML and JavaScript skills. Follow along and level up your web development expertise today

Code : 

<form action="">
       <div class="form-group">
           <label for="">Enter Name Here Number</label>
           <input type="text" onkeypress="return event.charCode >= 65 && event.charCode <= 90  || event.charCode >= 97 && event.charCode <= 122 || event.charCode ==32 " placeholder="Enter name" class="form-control w-25">
       </div>
   </form>

Note: here i use HTML ASCII Code  Reference . 

ASCII Printable Characters :

ASCII (American Standard Code for Information Interchange) defines a set of 128 characters, including control characters such as line feed and carriage return, as well as printable characters. Here's a list of the printable ASCII characters along with their corresponding decimal values:

  • Decimal 32: Space
  • Decimal 33: !
  • Decimal 34: "
  • Decimal 35: #
  • Decimal 36: $
  • Decimal 37: %
  • Decimal 38: &
  • Decimal 39: '
  • Decimal 40: (
  • Decimal 41: )
  • Decimal 42: *
  • Decimal 43: +
  • Decimal 44: ,
  • Decimal 45: -
  • Decimal 46: .
  • Decimal 47: /
  • Decimal 48-57: 0-9 (digits)
  • Decimal 58: :
  • Decimal 59: ;
  • Decimal 60: <
  • Decimal 61: =
  • Decimal 62: >
  • Decimal 63: ?
  • Decimal 64: @
  • Decimal 65-90: A-Z (uppercase letters)
  • Decimal 91: [
  • Decimal 92: \
  • Decimal 93: ]
  • Decimal 94: ^
  • Decimal 95: _
  • Decimal 96: `
  • Decimal 97-122: a-z (lowercase letters)
  • Decimal 123: {
  • Decimal 124: |
  • Decimal 125: }
  • Decimal 126: ~

 


Share this article







Related Posts




0 Comments



Load more Comments

Post a Comment


helllo
Ocec Copyright text of dont't copyright our content