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

  • SEARCH
  • Home
  • 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 8878001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:36:25+00:00 2026-06-14T19:36:25+00:00

i m currently reading jquery and i m facing some issues on jquery functions..

  • 0

i m currently reading jquery and i m facing some issues on jquery functions.. can any one guide me regarding functions . currently i want to create only one function and call twice a time if req is same .. but function is not working pls experts guide me in the code .

var errorAlpha = function(){

        $(this).focus().keyup(function(){

            var reg = /^([A-Za-z]+)$/;
            var check = $(this).val();              

            if(reg.test(check)==true && check.match(reg)==true)
              {
                    $(this).removeClass('error_Aplha');
              }
              else {
                    $(this).addClass('error_Aplha');
              }

            }),blur(function(){

                var check = $(this).val();
                var reg = /^([A-Za-z]+)$/;

                if(reg.test(check)==true && check.match(reg)==true)
                  {
                    $(this).removeClass('error_Aplha');
                  }
                else {
                    $(this).addClass('error_Aplha');
                  } 

            });


    };

        $('#step1 #fName').function(errorAlpha());

Html Is here

<input type="text" class="width-260" id="fName"/>

Css is here

.error_Aplha {
border:1px solid #b20000 !important;    

box-shadow: 0px 0px 5px #b20000;
-webkit-box-shadow: 0px 0px 5px #b20000;
-moz-box-shadow: 0px 0px 5px #b20000;
 }
  • 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-14T19:36:26+00:00Added an answer on June 14, 2026 at 7:36 pm

    Your code $('#step1 #fName').function(errorAlpha()); is wrong. Nothing is going to happen.

    If you want to trigger something then you need to attach a event handlers like click, key, mouse events. Here is the one way to set event handler,

     $('#step1 #fName').keypress(function(){
       errorAlpha();
     });
    

    Here is the list of jQuery event methods, http://api.jquery.com/category/Events/

    Update:

    I updated your code and it’s working here http://jsfiddle.net/muthkum/gU3PU/2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hope you can help me on this one, I'm currently using this: jQuery plugin:validation
I'm currently reading up on jQuery to fill some gaps in knowledge. Looking at
I'm currently reading through this jquery masking plugin to try and understand how it
I'm currently reading Learning Rails 3. I'm working on an example where you can
I'm currently creating some custom attributes for doing uploaded file validation. One of which
I'm currently learning jQuery by reading jQuery in Action. The book discusses separation of
I am new to JQuery. I'm reading JQuery in action, but only up to
im currently reading a book about programming Android and there is a nice little
Context I'm currently reading about Clojure's implementation of monads: org.clojure/algo.monads Intuitively, reduce looks like
I'm currently reading Rails 3 In Action. There is code that I was wondering

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.