Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8947733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:50:33+00:00 2026-06-15T12:50:33+00:00

I am using Jquery Validation. Currently, I have a textfield. How can I prompt

  • 0

I am using Jquery Validation.

Currently, I have a textfield. How can I prompt an alert when user type in 0 or any other symbols as the first character in the field?

 $.validator.addMethod(
    "regex",
    function(value, element, regexp) {
        var re = new RegExp(regexp);
        return this.optional(element) || re.test(value);
    },
    "Please check your input."
 );
 $("#Textbox").rules("add", { regex: "^[a-zA-Z'.\\s]{1,40}$" })
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:50:34+00:00Added an answer on June 15, 2026 at 12:50 pm

    Just looking at the regex, if all you want is to prevent the first character from being a zero and nothing else, it should be

    $("#Textbox").rules("add", { regex: "^[^0]$" })
    

    To exclude symbols as well you can either add them to the list of prohibited characters

    $("#Textbox").rules("add", { regex: "^[^0$-/:-?{-~!"^_`\[\]]$" })
    

    or specify the characters which are allowed. In this case, lower and uppercase letters, the numbers 1-9, an apostrophe, period or a space

    $("#Textbox").rules("add", { regex: "^[a-zA-Z1-9'.\s]" })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQuery validation plugin. I have two images: first background of label, when
Im using jQuery's validation which can be found here: http://docs.jquery.com/Plugins/Validation/rules#.22add.22rules I currently have some
hope you can help me on this one, I'm currently using this: jQuery plugin:validation
I am using Jquery Validation . Currently, I have a username, what i want
I have a problem trying to validate a user value using the jQuery Validation
I am currently using the jquery validation plugin that can be found at: http://bassistance.de/jquery-plugins/jquery-plugin-validation/
I am using jquery validation plugin for form validation. I have added a custom
I'm using the jQuery Validation plugin on my forms. I have some groups of
I am using the jquery validation plugin to validate a form. I have the
I'm currently using the jQuery Validate plugin for my input validation. It is used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.