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 7772309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:51:34+00:00 2026-06-01T16:51:34+00:00

I have a form that has dynamic controls created using jQuery. I have applied

  • 0

I have a form that has dynamic controls created using jQuery. I have applied validations on the controls using jQuery. I am validating the controls on blur event. The problem here is that i need to set the focus on the same control where validation fails on blur event.

I have done something like this:

$(propVal1).blur(function () {
    if(!ValidateNumber(this, propName1)) {
        alert('Value should be numeric in ' + propName1);
        setTimeout(function() {$(this).focus();}, 1);
    }
});

Where propVal1 represent an input control created dynamically, propName1 is the string name of the property.

  • 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-01T16:51:36+00:00Added an answer on June 1, 2026 at 4:51 pm

    The reason this is happening is that your input control is the only control in the window, so after it loses focus the whole window loses focus and you can’t focus an input in a window that doesn’t have the focus.

    This is the test html I made to confirm this:

    <form>
        <input id="my_input" type="text" />
        <input id="my_input2" type="text" />
    </form>
    
    <script type="text/javascript">
        $("#my_input").blur( function () { alert('bad input'); setTimeout( function() { $(window).focus(); $("#my_input").focus() }, 1 ); return false }  );
    </script>
    

    If you comment out the second input the code will not work!

    One possible solution is to have an invisible input after your input to catch the focus when the first one blurs.

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

Sidebar

Related Questions

I have a form with a stage that has a dynamic number of groups
I have a form that has all the fields pulled dynamic from a database
I have a dynamic form that is generating a country list. My problem is
I have a simple Widget that I've created using a ContentPart. The ContentPart has
I have a web form which has dynamic table using repeating rows. New rows
I have a form that has a section with a dynamic number of inputs,
I have a form that has multiple fields, and for testing purposes is there
I have a form that has a public property public bool cancelSearch = false;
I have a form that has a group of 3 text_fields. I need two
I have a form that has many long-methods. My quest is: What is the

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.