How to allow alphabets, numbers in input textbox in Javascript

How to allow alphabets numbers in textbox

How to allow alphabets, numbers in input textbox in Javascript (जावास्क्रिप्ट में इनपुट टेक्स्टबॉक्स में अक्षर और संख्याएँ कैसे डालें)-

Input type text box Regex validations for alphabets, numbers, alphanumeric and email in JavaScript (जावास्क्रिप्ट में अक्षर, संख्या, अल्फ़ान्यूमेरिक और ईमेल के लिए इनपुट प्रकार टेक्स्ट बॉक्स रेगुलर एक्सप्रेशन सत्यापन).

  • Example 1 – How to allow only alphabets in an input type text box (इनपुट प्रकार के टेक्स्ट बॉक्स में केवल अक्षरों को कैसे अनुमति दें)-
<input type="text" oninput="this.value = this.value.replace(/[^a-z A-Z]/g, '').replace(/(\..*)\./g, '$1');" name="studentName" id="studentName">
  • Example 2 – How to allow only numbers in an input type text box (इनपुट प्रकार के टेक्स्ट बॉक्स में केवल संख्याओं की अनुमति कैसे दें)-
<input type="text" oninput="this.value = this.value.replace(/[^0-9]/g, '').replace(/(\..*)\./g, '$1');" name="mobileNo" id="mobileNo">
  • Example 3 – How to allow only alphabets and numbers in an input type text box (इनपुट प्रकार के टेक्स्ट बॉक्स में केवल अक्षर और संख्याएँ कैसे अनुमति दें)-
<input type="text" oninput="this.value = this.value.replace(/[^0-9 a-z A-Z]/g, '').replace(/(\..*)\./g, '$1');" name="IFSC_Code" id="IFSC_Code">
  • Example 4 – How to validate email in an input type text box (इनपुट प्रकार टेक्स्ट बॉक्स में ईमेल को कैसे मान्य करें)-
<input type="text" oninput="this.value = this.value.replace(/[^ . @ _ - 0-9 a-z A-Z]/g, '').replace(/(\*)\./g, '$1');" name="email_id" id="email_id">

How to allow alphabets, numbers in input textbox in Javascript

How to open PDFs in Iframe Onclick the Button…

Tags: How to allow alphabets, Input textbox Regex validations for alphabets, JS to allow only alphabets in textbox, numbers, numbers in input textbox in Javascript

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *